note 51606 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Fri, 20 Apr 2007 14:56:03 +0000 |
| Subject: | note 51606 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125669@lists.php.net to get a copy of this message | ||
Note Submitter: james at charity dot org
----
If you're creating a download page for Internet Explorer, the following code works:
if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/",
$_SERVER['HTTP_USER_AGENT'])) {
// IE Bug in download name workaround
ini_set( 'zlib.output_compression','Off' );
}
header('Content-type: ' . $file['type']);
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Disposition: attachment; filename="' . $file['filename'] .
'"');
print($file['data']);
I will note that setting content length or size headers will cause IE to see the file being
opened/saved as 0 bytes and will on occasion open the content of the file in the browser itself
after the download fails.
I also recieved file not found problems until I added the Pragma and Cache-Control headers.
Yet another one of those "Thanks Bill" situations.
--james