ID: 32970
User updated by: flobee at gmail dot com
Reported By: flobee at gmail dot com
Status: Bogus
Bug Type: Filesystem function related
Operating System: suse/debian/winXP
PHP Version: 5.0.4
New Comment:
hmmm. my hoster still has this bug,
i just reported this as "note" for other users to have a work around.
<?php
function readfile_chunked($filename,$retbytes=true) {
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = '';
$cnt =0;
// $handle = fopen($filename, 'rb');
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
}
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
echo $buffer;
if ($retbytes) {
$cnt += strlen($buffer);
}
}
$status = fclose($handle);
if ($retbytes && $status) {
return $cnt; // return num. bytes delivered like readfile()
does.
}
return $status;
}
?>
kind regards
flobee
Previous Comments:
------------------------------------------------------------------------
[2005-05-06 20:39:28] [EMAIL PROTECTED]
Fixed in CVS several weeks ago.
------------------------------------------------------------------------
[2005-05-06 19:00:10] flobee at gmail dot com
Description:
------------
when file lager than ~ 2MB i only get ~2MB send to the header
eg:
if($result_size = @readfile( $file_to_download) ) { ;
$msg = _DOWNLOAD_SUCCESSFUL;
} else {
$msg = _ERROR_COULDNOTCOMPLETETHEFILE;
}
this is since php5 beta and have no idea why, no error no other
messages.
execution time and memorylimit are set very high for testing. no
changes.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32970&edit=1