c...@l-i-e.com wrote:
>>     echo fread($HANDLER, $FSIZE);
> 
> This is your problem child right here...
> 
> Sucking in an entire OGG File to RAM, for a large OGG file, will be quite 
> painful.
> 
> And, on a busy server, even moderate size files will be problematic.
> 
> You could probably relieve a lot of stress and keep full-size downloads just 
> by doing:
> 
> define('CHUNK_SIZE', 2048);
> define('DOWNLOAD_LIMIT', 10*1024);
> 
> while (!feof($HANDLER)){
>   echo fread($HANDLER, CHUNK_SIZE);
> }
> 
> To answer your original question, you would abort this loop partway though, 
> using some kind of counter *= CHUNK_SIZE and compare it to DOWNLOAD_LIMIT.
> 
> 

ceo, you made me realize a problem with yours and my example also.

When mentioning the RAM usage problem, one might consider calling flush() after 
each echo,
just to make sure that they don't run over PHPs memory limit.

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to