I have a CSV file on my server. If a user clicks on a link it should download, but instead it opens up in my browser window.
My code looks as follows
A previous answer on this page describes how to use .htaccess to force all files of a certain type to download. However, the solution does not work with all file types across all browsers. This is a more reliable way:
ForceType application/octet-stream
Header set Content-Disposition attachment
You might need to flush your browser cache to see this working correctly.