note 81045 added to function.header
| From: | blinkibill at osu1 dot php dot net | Date: | Tue, 12 Feb 2008 16:33:19 +0000 |
| Subject: | note 81045 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136067@lists.php.net to get a copy of this message | ||
if you are planing to make a download script like this one:
<?php
$mm_type="application/octet-stream";
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($fullpath)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
readfile($fullpath);
?>
you will notice that the zip files becomes invalid after download, thats because all files
downloaded starts with empty line which is a problem for the zip files
This can be fixed with adding ob_start() at the beginning of the script and od_end_clean() just
before the readfile()
----
Server IP: 217.75.128.29
Probable Submitter: 78.83.81.205
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/81045
Del: integrated -- https://master.php.net/note/delete/81045/integrated
Del: useless -- https://master.php.net/note/delete/81045/useless
Del: bad code -- https://master.php.net/note/delete/81045/bad+code
Del: spam -- https://master.php.net/note/delete/81045/spam
Del: non-english -- https://master.php.net/note/delete/81045/non-english
Del: in docs -- https://master.php.net/note/delete/81045/in+docs
Del: other reasons-- https://master.php.net/note/delete/81045
Reject -- https://master.php.net/note/reject/81045
Search -- https://master.php.net/manage/user-notes.php