Bug #17885: corrupted file downloads with fpassthru/fread/readfile
| From: | dariusz at bulgaria dot com | Date: | Thu, 20 Jun 2002 20:06:41 +0000 |
| Subject: | Bug #17885: corrupted file downloads with fpassthru/fread/readfile | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-11606@lists.php.net to get a copy of this message | ||
From: dariusz@bulgaria.com
Operating system: WinXP Pro
PHP version: 4.2.1
PHP Bug Type: Apache2 related
Bug description: corrupted file downloads with fpassthru/fread/readfile
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 bug report at http://bugs.php.net/?id=17885&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17885&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17885&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17885&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17885&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17885&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17885&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17885&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17885&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17885&r=globals