Force download (CSV) file


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. header("Pragma: public");
  2. header("Expires: 0");
  3. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  4. header("Cache-Control: private",false); // required for certain browsers
  5. header("Content-type: application/csv");
  6. header("Content-Disposition: filename=\"filename.csv\";");
  7. header("Content-Transfer-Encoding: binary");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.