note 54108 added to function.passthru
| From: | igor at bboy dot ru | Date: | Thu, 23 Jun 2005 20:33:35 +0000 |
| Subject: | note 54108 added to function.passthru | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90865@lists.php.net to get a copy of this message | ||
If you are using passthru() to download files (for dynamically generated content or something
outside webserver root) using similar code:
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"myfile.zip\"");
header("Content-Length: 11111");
passthru("cat myfile.zip",$err);
and your download goes fine, but subsequent downloads / link clicks are screwed up, with headers and
binary data being all over the website, try putting
exit();
after the passthrough. This will exit the script after the download is done and will not interfere
with any future actions.
----
Manual Page -- http://www.php.net/manual/en/function.passthru.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54108
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54108&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54108&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54108&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54108&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54108&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54108&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54108&report=yes
Search -- http://master.php.net/manage/user-notes.php