Jump to content


File Download Script Problem

  • Please log in to reply
No replies to this topic

#1 shoaibi

  • Members
  • PipPip
  • Member
  • 21 posts

Posted 07 September 2006 - 12:07 PM

Hmmm well i am a mediocre kindda programer of PHP as of yet and work on hit and trial basis. So i created a script which hides the actual location of the file i.e. an anti leech script, though it may not be perfect, and i was using readfil() function to allow users to download files. But it took to much time for files greater then 2MB. so i created another function, infact copied from a place and modified it as i needed which is provided as below.
function readfile_chunked ($filename) {
$chunksize = 50*(1024*1024); // how many bytes per chunk
$buffer = '';
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
print $buffer;
return fclose($handle);

So now the problem is that files upto 100MB can be handled easily while files with 172,700MB or 2GB size aren't handles as fast as they should be. Infact i am creating an anime download site and for that i wanna make the script fastest. Any suggestions?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users