|
Posted by Sjoerd on 10/28/76 11:33
@Sean: He is not worried about performance, he is worried that he will
not have enough memory to let 10 users download a 1 GB file.
@Cousin: Please read the comments on
http://www.php.net/manual/en/function.readfile.php. They say that
readfile is slower, modifies the "last-modified" time and reads the
entire file in memory. You are probably better off with a fread loop:
$fp = fopen("filename", "r");
while ($data = fread($fp, 100000)) {
echo $data;
}
fclose($fp);
One more thing to think about: normally, PHP pages have a maximum
execution time of 30 seconds. Use set_time_limit to allow transfer
taking longer than 30 seconds.
Another possibility is to have the PHP script do logging and what not,
and then redirect to the actual file:
header("Location: http://my.host.com/actual.file");
[Back to original message]
|