Bug #17885 Updated: corrupted file downloads with fpassthru/fread/readfile
| From: | dariusz at bulgaria dot com | Date: | Fri, 21 Jun 2002 10:51:20 +0000 |
| Subject: | Bug #17885 Updated: corrupted file downloads with fpassthru/fread/readfile | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-11655@lists.php.net to get a copy of this message | ||
ID: 17885
Updated by: dariusz@bulgaria.com
Reported By: dariusz@bulgaria.com
-Status: Feedback
+Status: Open
Bug Type: Apache2 related
Operating System: WinXP Pro
PHP Version: 4.2.1
New Comment:
Built a little test page if someone's interested:
http://test.dariusz.info/
Previous Comments:
------------------------------------------------------------------------
[2002-06-21 05:44:03] dariusz@bulgaria.com
Tried it with fopen($f,"rb")/fread, with fopen($f,"rb")/fpassthru and
with readfile($f). Doesn't work with all three methods.
------------------------------------------------------------------------
[2002-06-21 05:06:53] hholzgra@php.net
does it work with
$fp = fopen($f, "rb");
fpassthru($fp);
// no fclose() needed
or just
readfile($f); // might not be binary safe
?
------------------------------------------------------------------------
[2002-06-20 16:06:40] dariusz@bulgaria.com
OS: WinXP Pro
Apache 2.0.36
PHP 4.2.1 (module)
That's my script:
$f = "e:/web/old.zip";
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=old.zip");
header("Content-Length: " . filesize($f));
$fp = fopen($f, "rb");
while (!feof($fp))
{
print fread($fp, 1024);
}
fclose($fp);
The script is running on a server in my local 100MBit LAN.
The first ~8kB of the downloaded file are always OK, but from there on
the file is totally screwed up. Filesize is correct though.
Tried the same script with Apache 1.3.26 (also the module version) with
basically the same configuration and the download works fine. Switched
again to 2.0.36 and the downloads are corrupted again. This seems to
happen only with large files (the one I tried is ~11MB).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17885&edit=1