using headers to download a file takes too long

From: Date: Thu, 05 Aug 2004 10:58:19 +0000
Subject: using headers to download a file takes too long
Groups: php.general 
Request: Send a blank email to php-general+get-192825@lists.php.net to get a copy of this message
Hi, I'm writing a few scripts that allows users to download files, some around 45MB+. The files are stored outside the webroot, for security reasons, so when the user clicks on the link, this called my downloadFile.php script, this script accesses the requested files, using the path relative to the top of the actual file system, then outputs the correct headers for the mimetype and file length (to assist in the download box status time), for small files, then this is really quick and works great, yet for files from say 10MB or more, it takes around a minute before the download box even pops up. 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). Can anyone advise me on what I may be doing wrong, code examples can be supplied if required. Cheers in advance Mark

« previous php.general (#192825) next »