Re: Timeout while waiting for a server->client transfer to start (large files)
| From: | Chris | Date: | Wed, 30 Jan 2008 07:01:54 +0000 |
| Subject: | Re: Timeout while waiting for a server->client transfer to start (large files) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268305@lists.php.net to get a copy of this message | ||
Barney Tramble wrote:
Hey
I have a script that I am trying to figure out to allow a remote file to be sent to a client's browser. It works ok for small files, but it keeps timing out for large files. I don't think it should even take as long as it does (i.e. about 10seconds) before it pops up a dialog box for me to download a 700KB file. Any ideas? It times out on a line around which reads
while (!feof($fp))
{
$tmp .= fread($fp, 64);
}
Well you're still reading the file (or url or something) at this point. Is it the reading of the file or sending it to the browser that fails?
A bit of context might help for this code too. Is this reading a local file or url or what?
If it's a local file, use fpassthru (http://php.net/fpassthru) if it's not too big. If it is a big file then use your loop but don't store it in a $tmp variable, just output it.
--
Postgresql & php tutorials
http://www.designmagick.com/