Here is a workaround for the IE problem of not properly respecting

content-type and content-dispositition HTTP headers which results in it

not being able to save attachments under certain circumstances.

A fairly good developer’s writeup and discussion resides at

blogs.msdn.com/ie/archive/2005/02/01/364581.aspx. It explains

why this problem exists and Microsoft’s reason for creating the

problem.

There are cases where Internet Explorer will not allow a report to save when the URL was called directly. Sometimes you could trick IE by starting the download, cancelling, and refreshing the

page, but it’s an absurd workaround that doesn’t work reliably.

This article (www.onaje.com/php/article.php4/40) shows how to placing the following lines in a

PHP file:

header(“Expires: 0”);

header(“Cache-Control: no-cache, must-revalidate,

post-check=0, pre-check=0”);

header(“Content-type: application/octet-stream”);

header(“Content-Disposition:

attachment;filename=\”export.csv\””);

The Content-type, Content-Disposition, Pragma: no-cache, and Expires

lines worked just fine with Firefox, but not with IE. The only new addition was the

Cache-Control line which when added seemed to do the trick. The

preexisting Pragma: no-cache directive which was made redundant and so you

combine it into the Cache-Control line with the “no-cache” part of the

string.

References:

blogs.msdn.com/ie/archive/2005/02/01/364581.aspx

www.onaje.com/php/article.php4/40

www.w3.org/Protocols/rfc2616/rfc2616-sec14.html