Jump to content

File Download Script Problem


shoaibi

Recommended Posts

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.
[code]
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);
}
[/code]

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.