Page 1 of 1

Download interrupted after around 5 min.

Posted: Tue Oct 12, 2004 8:31 am
by Cezar
twigletmac | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Hello everybody!

I have a problem with downloading big files (e.g 50 MB) using PHP coding; after around 5 min. from the start the download is interrupted and the file cannot be used.
The code used to download the file is listed below:

Code: Select all

<?php 
$filename = $_GET['filename']; 
$filename=rawurldecode($filename);
if(!$filename){ echo "ERROR: No filename specified. Please try again."; } 
else { 
     
// fix for IE catching or PHP bug issue 
header("Pragma: public"); 
header("Expires: 0"); // set expiration time 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
// browser must download file from server instead of cache 

// force download dialog 
header("Content-Type: application/force-download"); 
header("Content-Type: application/octet-stream"); 
header("Content-Type: application/download"); 

// use the Content-Disposition header to supply a recommended filename and 
// force the browser to display the save dialog. 
header("Content-Disposition: attachment; filename=".basename($filename).";"); 

header("Content-Transfer-Encoding: binary"); 

readfile($filename); 
exit(); 
} 

?>
Thanks for any suggestions.

Posted: Tue Oct 12, 2004 10:51 am
by Wayne
what is your max_execution_time set to in your php configuration?