Lots of people seem to have this problem but mine does not seem to resolve by changing headers:
It works perfectly in FireFox, not at all in IE, I get the Error:
Internet Explorer cannot download (script name) from (site)
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
This has nothing to do with PDF or SSL.
I've tried every conceivable code combination, here's the latest stab:
<?php $dir = dirname(__FILE__); chdir($dir); $file="testfile.zip"; $filesize = filesize($file); $filename = trim(basename($file)); ini_set('zlib.output_compression', 'Off'); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Vary: Accept-Encoding"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=$filename;"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$filesize); @readfile($file); exit; ?>
To complicate things, this code works perfectly well with IE on another server. Both servers are running PHP 4.4.2 and Apache (1.3.36 (Unix) works, 2.0.46 (Red Hat) fails)
I tried a header sniffer (http://web-sniffer.net) but it fetches all headers correctly from both servers. Both look essentially identical. Also, notice that the error message (and the IE dialog) refer to the download by the script name, not the supplied filename. I don't think IE is even getting the headers! I tried using flush() after the headers (before "readfile()") but to no effect.
What kind of configuration issue might be causing this?