note 34112 deleted from function.header by sniper
| From: | sniper@php.net | Date: | Sun, 07 Sep 2003 21:48:17 +0000 |
| Subject: | note 34112 deleted from function.header by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55659@lists.php.net to get a copy of this message | ||
Note Submitter: art at artstower dot com
----
To be binary safe, don't send the \n !
After testing the downloaded files with md5 their checksum was always wrong.
After removing the \n their checksum was correct again.
Tested with
MS IE 6sp1, Opera 7.02, Mozilla 1.3.1 (on Windows XP)
Here is the code:
--cut--
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header('Accept-Ranges: bytes');
header('Content-Length: ' . $file_size);
header('Connection: close');
if ($mime_type)
header("Content-Type: $mime_type");
header('Content-Disposition: attachment; filename=' . $file);
readfile($file);
--cut--
Note: By using "attachment" instead of "inline" the MSIE was smart enough to
download the files and not open them always.