Actually, scrap my first answer, I think it's to do with the size of the
script.  It grows with the size of the file I believe.  Instead of using
fpassthru(), use a buffer instead:


 while(!feof($fd)) {
   $buffer = fread($fd, 4096);
   print $buffer;
 }
 fclose($fp);

That may work better, in fact I've personally used something like that for
something similar (writing a remote file to the server)

Let me know?

Ross

-----Original Message-----
From: Ronny Salomonsen [mailto:[EMAIL PROTECTED]]
Sent: 20 January 2002 09:13
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] "The connection with the server was reset"


I've created a simple downloadscript that handles file downloads (it
redirects to a file that cannot be accessed through internet.

After 2% I get the following errormessage:
    Internet Explorer cannot download basedata.mdb from [removed]
    The connection with the server was reset

The script has downloaded 411 kb of 17.6 MB, and other people has a similar
problem. Sometimes it downloads about 5 MB and closes the downloading window
and says it has successfully downloaded the file.

What could be wrong?

I'm running PHP 4.1.1 on a MS IIS 5.0 server. The code is as follows:

<?php
    set_time_limit(0);
    error_reporting(E_ALL);

 $get = "basedata.mdb";

    // Handle download-requests
 header("Content-Type: application/force-download\n");
 header("Content-Disposition: attachment; filename=\"$get\"\n");
 header("Content-Description: GAB database\n");
 header("Content-Transfer-Encoding: binary\n");
 header("Content-Length: " . filesize($get));

 $fd=fopen($get,'r');
 fpassthru($fd);

 readfile($get);
 exit;
?>



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to