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


Add the below line to apache httpd.conf in <IfModule mime_module>

block



AddType application/octet-stream .csv

      

0


source


The above answers don't work, why ... I added the AddType / octet-stream csv app to the .htaccess file located in the site's public folder @ mamp / htdocs / website / public but still no luck

0


source







All Articles