Bug #13254: Canceld downloaded will end up in browserwindow
| From: | php at lucard dot to | Date: | Tue, 11 Sep 2001 21:11:21 +0000 |
| Subject: | Bug #13254: Canceld downloaded will end up in browserwindow | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-65797@lists.php.net to get a copy of this message | ||
From: php@lucard.to
Operating system: Slackware 8.0
PHP version: 4.0.6
PHP Bug Type: Output Control
Bug description: Canceld downloaded will end up in browserwindow
I made a script to start a download of a picture, when u cancel the
download and refresh the parent the binary data of the download is
displayed in the browser window.
How to reproduce:
- call the script below from a simple HTML page.
- Cancel the download
- refresh the HTML page
Then you will see the binary data of the image ($file). So the $file must
be a valid image.
http://lucard.no-ip.com/hety/1.php <-- for demo
1.php is the simple html file....
<?
$file="images/dscf0009.jpg";
$fp=@fopen($file,"r");
header("Content-Type: application/force-download");
header("Content-Length: " .filesize($file));
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) {
header("Content-Disposition: filename=\"".$file ."\"");
}
else {
header("Content-Disposition: attachment; filename=\"".$file ."\"");
}
header("Content-Transfer-Encoding: binary");
fpassthru($fp);
die();
?>
--
Edit bug report at: http://bugs.php.net/?id=13254&edit=1