Google Gruppi non supporta più i nuovi post o le nuove iscrizioni Usenet. I contenuti storici continuano a essere visibili.

Download via PHP problem

0 visualizzazioni
Passa al primo messaggio da leggere

Bert

da leggere,
14 ott 2003, 04:11:2814/10/03
a
Hello,

I'm using a script to handle downloads of files, it seems to work but
I'm getting random server errors. I guess it has something to do with
the filesize. The script will be needed to download files of 6 to 8 MB
but I've only tested with files from 0.5 to 2.5 MB.

I get the following error:
The server closed the connection while reading the response. Contact
your system administrator. (SERVER_RESPONSE_CLOSE)

All help is greatly apreciated!

B.

<?php
//...
//Download part of the script:
$zipfile="/path/to/the/zipfiles/".$_POST['orderid'].".zip";
if (empty($zipfile) || !file_exists($zipfile)) {
header("HTTP/1.1 404 Not Found");
header("Status 404");
Header("Location:icouldnotfindthatfile");
}
else {
$filesize=filesize($zipfile);
$name= $_POST['orderid'].".zip";
$mime='application/x-zip';
//hack for bloody ie5.5
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT))
{header("Content-Disposition: filename=$name");}
//other browsers
else {header("Content-Disposition: attachment; filename=$name");}
header("Content-Type: $mime");
header("Content-Length: $filesize");
header ("Content-Transfer-Encoding: binary");
$fh = fopen($zipfile, "r");
fpassthru($fh);
}
?>

Fabian Wleklinski

da leggere,
14 ott 2003, 04:53:3914/10/03
a
Hi Bert,

may be you have to increase the maximum execution time of
your script, see [1].


Greetings from Frankfurt / Germany,

Fabian Wleklinski


[1] http://www.php.net/function.set-time-limit


0 nuovi messaggi