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 href="files/csv/example/example.csv" class="pagination">Click here to download an example of the "CSV" file</a>
It's a web server normal webserver where I have all of my dev work on.
I tried someting like
<a href="files/csv/example/csv.php" class="pagination">Click here to download an example of the "CSV" file</a>
NOW the contents of my csv.php file:
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=example.csv');
header('Pragma: no-cache');
Now my issue is it's downloading but not my CSV file it's creating a new file.