[PHP-DEV] Bug #13254: Canceld downloaded will end up in browserwindow From: php <email protected>
Date: 09/11/01

From: php <email protected>
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= <email protected>($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

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>