|
Posted by Hendri Adriaens on 02/23/07 15:44
> Hmnmz, perhaps a flush() after readfile_chunked is in order here,
Sorry, it still doesn't work.
> or you server buffers output?
I don't know that exactly, I didn't write the readfile_chunked script. But
here it is for your reference:
function readfile_chunked($filename,$retbytes=true)
{ # from: http://nl2.php.net/manual/nl/function.readfile.php
$chunksize=1*(1024*1024); // how many bytes per chunk
$buffer='';
$cnt=0;
$handle=fopen($filename, 'rb');
if ($handle===false) {
return false;
}
while (!feof($handle))
{
$buffer=fread($handle,$chunksize);
echo $buffer;
ob_flush();
flush();
if ($retbytes)
{
$cnt+=strlen($buffer);
}
}
$status=fclose($handle);
if ($retbytes && $status)
{
return $cnt; // return num. bytes delivered like readfile() does.
}
return $status;
}
Best regards,
-Hendri.
Navigation:
[Reply to this message]
|