Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent downloads from timing out

Status
Not open for further replies.

LiquidSchwarz

Programmer
Joined
Apr 24, 2003
Messages
9
Location
US
I have a website where visitors can download zip files of CAD utilities. Some of my visitors have reported that the downloading of these files times out and they are unable to fully download the files (zip files about 600KB in size).

I am trying to find a way that to ensure that the files download completely without timing out. At the very least, I would like to be able to warn people is the download was interrupted.

Is there a way to prevent downloads from timing out? Web service is Yahoo Business, they say it's not a server issue.

I've tried adding content header information (from php.net documentation) to the hyperlinks. It has helped somewhat but not completely.

I am a PHP greenhorn so please be gentle and use small words :)

Sample of what I've tried posted below.

<?php
$bigfile=&quot;../downloads/waycoolapp.zip&quot;
if ((is_integer (strpos($user_agent, &quot;msie&quot;))) && (is_integer (strpos($user_agent, &quot;win&quot;))))
{$deestat=&quot;filename=&quot;; }
else
{$deestat=&quot;attachment; filename=&quot;;}
?>

<P><A HREF=&quot;<?php
set_time_limit (0);
header(&quot;Pragma: public&quot;);
header(&quot;Expires: 0&quot;);
header(&quot;Cache-Control: must-revalidate, post-check=0, pre-check=0&quot;);
header(&quot;Content-Type: application/force-download&quot;);
header(&quot;Content-Type: application/zip&quot;);

header( &quot;Content-Disposition: &quot;.$deestat.$dm2003);

header(&quot;Content-Transfer-Encoding: binary&quot;);
header(&quot;Content-Length: &quot;.filesize($bigfile));
header( &quot;Content-Description: File Transfert&quot;);
print $bigfile;
?>
&quot;>Download my way cool app!</A>
 
Ok, first, does the download timeout if they/you type the link in directly and download it?
Second, the header() function you are using is for defining the type of file the php is about to output... not the type of file the link is for. It has to be used before anything else is sent to the browser.
I cant think of why the download would timeout unless its just a really busy server, or theres setting on the server.
Either way, I dont know of anything in php that would cause a download to be interupted
 
php isn't interrupting the download. The download was being interrupted before my ham-fisted php tinkering (which does seem to have improved things, though that may be spurious).
 
hmmmm, I think it may be related to the web server your using then. If the download start ok and the file isn't being passed through a php file then its nothing to do with php.
Sorry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top