Download via PHP problem

This is a discussion on Download via PHP problem within the PHP Language forums, part of the PHP Programming Forums category; Hello, I'm using a script to handle downloads of files, it seems to work but I'm getting random ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-14-2003
Bert
 
Posts: n/a
Default Download via PHP problem

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);
}
?>
Reply With Quote
  #2 (permalink)  
Old 10-14-2003
Fabian Wleklinski
 
Posts: n/a
Default Re: Download via PHP problem

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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0