mercredi 5 septembre 2018

Return Download Docx File in Laravel 5

I'm trying to create a url that return word doc file when user visit.


I have tried

public function resume()
{

    $file= public_path(). "/docs/John's Resume.docx";
    $headers = array(
        'Content-Type: application/msword',
        'Content-Disposition:attachment; filename="cv.docx"',
        'Content-Transfer-Encoding:binary',
        'Content-Length:'.filesize($file),
    );

    ob_end_clean();
    return Response::download($file,"John's Resume.docx", $headers);

}

I kept getting

FileException in BinaryFileResponse.php line 97:
File must be readable.

enter image description here


Questions

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire