PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've managed to get the force download to work using the code below, but when i try and download a large file, it finishes before it has completed downloading and always just before taking 5 mins. I'm using IIS 6.0 and PHP 4.3.9, (but i have also tried it with IIS 5 and it did the same thing). Any ideas??
<?php
//Set this to the base of where files
//can be downloaded from for security measures.
$basedir = "C:/Websites/";
if(!$_GETї'file']) {
print "Sorry that file does not exist";
exit;
}
elseif(!file_exists($basedir.$_GETї'file'])) {
print "Sorry that file does not exist";
exit;
}
else {
header("Content-Type: octet/stream");
header("Content-Disposition: attachment; filename="".$_GETї'file'].""");
$fp = fopen($basedir.$_GETї'file'], "r");
$data = fread($fp, filesize($basedir.$_GETї'file']));
fclose($fp);
print $data;
}
?>їcode]
its set to 30 seconds, I have tried modifing this but it didnt make any difference. If it was that wouldn't it time out after 30 seconds rather than 5 mins (or 300 seconds)?