Professional Web Applications Themes

Download via PHP problem - PHP Development

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"); } ...

  1. #1

    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);
    }
    ?>
    Bert Guest

  2. #2

    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] [url]http://www.php.net/function.set-time-limit[/url]


    Fabian Wleklinski Guest

Similar Threads

  1. download problem with Mac OSX
    By liz55 in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: January 24th, 02:33 PM
  2. download problem
    By tony1915 in forum Macromedia Shockwave
    Replies: 9
    Last Post: September 21st, 10:01 PM
  3. Download problem Dreamweaver
    By pnny in forum Coldfusion - Getting Started
    Replies: 1
    Last Post: September 14th, 08:51 PM
  4. Same InstallAnywhere download problem
    By necessaryevil in forum Coldfusion - Getting Started
    Replies: 1
    Last Post: July 10th, 03:37 AM
  5. Force Download - XML problem
    By PJS in forum ASP.NET General
    Replies: 0
    Last Post: July 18th, 01:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139