473,320 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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);
}
?>
Jul 17 '05 #1
1 2401
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
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
12
by: Swede | last post by:
Hello, I am posting this rather lengthy description here in hope of getting at least some insight into a problem that is really hurting my business, since I have come to the conclusion that my...
7
by: Brian Paul | last post by:
When a user clicks on a linkbutton on a page, i would like to render a printer-friendly version of the asp.net page and download it as an html attachment to the browser. The code below works great,...
4
by: hoenes1 | last post by:
Hi, in my ASP.NET App, I have a list of files which the user can download on click (using Response.BinaryWrite()). the problem is, that once a download has started, the user can't navigate in...
1
by: Al | last post by:
Hi! I try to use custom download page (download.aspx) wich writes file (about 700Mb) to response. But I can download only one file from one IP at the same time. I think that this is IIS or...
2
by: Ken Varn | last post by:
I have an ASP.NET page that incorporates the following code on a button press. private void DownloadTag_Command(object sender, CommandEventArgs e) { FileStream fs; String Filename; Filename...
1
by: a.r.austin | last post by:
Hello, I am trying to download a few files one after another from a remote server. Problem is that I don't know how to, or if I am able at all, set a time out for download. I don't want to time...
3
by: tshad | last post by:
I have a function that downloads a file to the users computer and it works fine. The problem is that I then want the program to rename the file (file.move) to the same name plus todays date. ...
4
by: clintonG | last post by:
To all Microsoft partners and customers who have been unable to download recently or access ASP.NET documentation from the msdn2 website and for all of those customers who have been lied to and...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.