Response::download() laravel not working-shows error-Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)
In the previous blog entry i explained force download in laravel http://mydoubts.in/blog/force-download-in-laravel-file-download-in-laravel/ if you are getting the below error Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?) No need to change the php.ini settings -php_fileinfo extension below code will works using the header information
1 2 3 4 5 6 |
<?php $path=public_path()."/upload_image/mypic.jpg"; $file_name = 'mypic.jpg'; $headers = array('Content-Type' => 'application/octet-stream'); return response()->download($path, $file_name, $headers); ?> |