I have a simple php download script that streams a non-web-accessible file to the browser using this generally accepted method:
header("Expires: 0"); header("Cache-Control: private"); header("Content-Type: application/save"); header("Content-Length: ".filesize($total) ); header("Content-Disposition: attachment; filename=".$file_Path); header("Content-Transfer-Encoding: binary"); $fh = fopen($total, "rb"); fpassthru($fh); While it works, this is fairly useless in my situation where files range from 5mb to over 100mb, because due to fpassthru() or readfile() or whatever method used to stream the data to the recipient, the 'save as'/'open' dialog doesn't open until the entire file has been downloaded. This is very impractical since the user has no clue how much has been downloaded / how much longer is left, not to mention that on very large files (~75mb) apache will actually freeze up and become unresponsive to all users (sending cpu usage to 100%) for nearly 10 minutes or more, assumedly because it is still reading the file (regardless of whether the 'stop' button has been clicked or not). With the last 2 lines commented out (fopen() and fpassthru()), the save-as dialog opens instantly.. is there any way fopen/fpassthru() could be delayed until after the user chooses to open or save the file ? How would you guys go about handling large file downloads while keeping the files themselves non-web-accessible (aka not a direct link/redirector)? Any help would be appreciated. -KevinSync -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php