Connecting Tech Pros Worldwide Help | Site Map

Download via PHP problem

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:32 AM
Bert
Guest
 
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);
}
?>

  #2  
Old July 17th, 2005, 12:32 AM
Fabian Wleklinski
Guest
 
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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.