Force Download not completing
Posted: Wed Nov 24, 2004 5:39 am
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??
[quote][/quote]
Code: Select all
<?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]