Laravel file download response content type - text / html on localhost
I am trying to return a file upload response in laravel with a custom content type, the response content type comes as text / html to the browser at localhost. Whereas it works fine in server code. This makes debugging difficult.
Is it something to do with the Apache server configuration?
Below is the laravel code.
return Response::download($filepath, $filename.'_questionaire.csv', array(
'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment;filename="'.$filename.'._questionaire.csv"'
));
+1
source to share
3 answers
To force your browser to load CSV files, you can add this to your .htaccess file:
AddType application / csv octet-stream
You can also check:
http://www.thingy-ma-jig.co.uk/blog/06-08-2007/force-a-pdf-to-download
0
source to share