Bug #17885 Updated: corrupted file downloads with fpassthru/fread/readfile

From: Date: Thu, 27 Jun 2002 10:22:33 +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-12225@lists.php.net to get a copy of this message
ID: 17885 Updated by: dariusz@bulgaria.com Reported By: dariusz@bulgaria.com Status: Open Bug Type: Apache2 related Operating System: WinXP Pro PHP Version: 4.2.1 New Comment: Update: when using IMG SRC="somepic.php" where somepic.php only contains a content-type header and passes a picture file with fpassthru it doesn't work with Apache2, but it does work fine with Apache1. Apache2 sometimes shows the picture partially, sometimes not at all. Updated my test page on http://test.dariusz.info with this one. Previous Comments: ------------------------------------------------------------------------ [2002-06-21 06:51:20] dariusz@bulgaria.com Built a little test page if someone's interested: http://test.dariusz.info/ ------------------------------------------------------------------------ [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

« previous php.bugs (#12225) next »