* Thus wrote Mark Cooke:
> Hi,
> 
> I'm writing a few scripts that allows users to download files,
> some around 45MB+.
> ...
> I've tried using readfile and fread, to access the files, yet both seem 
> to take the same amount of time, it would seem like they are getting 
> buffered, or maybe read into memory, before they are allowed to be 
> downloaded, basically I'm trying to reproduce the same effect of having 
> the file in the webroot and creating a simple href to the actual file 
> (using this method, would show the location of the files, this is what 
> I'm trying to avoid).

readfile() will be the most efficient. It will read the file on the
system directly to the client.

One thing that will effect buffering in php would be the php.ini
option output_buffering, by default it will be ~4Kb, it shouldn't 
cause a noticable delay. Check to see if that setting is high.

Another thing that can cause the file to be buffer is if you have
the ini option output_handler set. Usually used with ob_gzhandler()
which will buffer content to get gzipped. 

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to