shoaibi Posted September 7, 2006 Share Posted September 7, 2006 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.