Jump to content

Archived

This topic is now archived and is closed to further replies.

shoaibi

File Download Script Problem

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?

Share this post


Link to post
Share on other sites

×

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.