I’d like to add a link for users to download data in .CSV format.
I can format data with PHP, but how do I make the file available to download (click and start downloading) instead of opening it in a browser?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can force download a file using PHP readfile. You may need to add the appropriate header for your csv (if that’s necessary) e.g.
Or to make it simple you can do something like:
It should bring a download dialog. Hope that helps.