08 Apr

Issues Creating and Downloading File in IE from PHP

Took a while to fix this one. The problem is you create a download button in HTML that leads to a PHP program that creates a file that Internet Explorer should download. The code works fine in Firefox just not IE.

The original code was something like:
{code type=php}
header(“Pragma: no-cache”);
header(“Expires: 0”);

header(“Content-disposition: attachment; filename=\”export.xls\”;”);
header(“Content-Type: application/vnd.ms-excel”);
{/code}
Which works in Firefox but not IE. The new code is:
{code type=php}header(“Pragma: “);
header(“Cache-Control: “);

header(“Content-disposition: attachment; filename=\”export.xls\”;”);
header(“Content-Type: application/vnd.ms-excel”);
{/code}
And that works fine.

Leave a Reply

Your email address will not be published. Required fields are marked *