How do I get csv file to download on IE? Works on firefox

Don’t we love IE? 🙂

Try using those headers:

  header("Pragma: public");
  header("Expires: 0");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Cache-Control: private",false);
  header("Content-Type: application/octet-stream");
  header("Content-Disposition: attachment; filename=\"exportevent.csv\";" );
  header("Content-Transfer-Encoding: binary"); 

I think that the octet-stream content type forces IE to download the file.

Leave a Comment