Reply to Re: check if file was downloaded

Your name:

Reply:


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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация