[thelist] http header function does not work in IE 5.0

Jay Blanchard jay.blanchard at niicommunications.com
Fri Jun 28 08:24:01 CDT 2002

This code  works in any browser, except MSIE

Has anyone else experienced this and maybe found a solution. None of the
one's I have found on the web have worked so far.

web server Apache, mod_ssl
This is on a secure page. I am trying to send headers through with PHP 4.1.2
I have already declared $file_name, $filesize and $file_path.

header("Content-Disposition: attachment; filename=$file_name");
header("Content-Type: application/pdf");
header("Content-Length: $filesize");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
$fp = fopen("$file_path", "r");

print fread($fp, $filesize);

Any version of IE starts to download the page instead of the file, it
basically ignores the first header!!

Try the "IE URL Fake Out" -

This was discovered and given to me by someone on thelist with regards to IE
and file types such as those from M$ Office. What had to be done to open,
for instance, an Excel spreadsheet was to have the URL be formed this way...


where thisfile.xls only exists as a URL entity. If this theory holds true
for other file types perhaps you could try;




More information about the thelist mailing list