server not downloading complete file

Discussion in 'Apache' started by ternto333, Jul 23, 2007.

  1. #1
    i have a php script that creates a file which always writes 100% of the data to this file. this part works fine. the next part of this script is letting the user download that file. when i run it on my localhost, everything is fine and 100% of the file is there. however, when i run it on a different server, for some reason when you download the file, it always gets cut off at 2000000 bytes. so the file that gets downloaded can be much smaller than the original file. is there something i need to change in the php.ini file or any other suggestions? this is my download.php code:

    $file=$path.$_GET['file'];
    header("Content-type: application/force-download");
    header("Content-Transfer-Encoding: Binary");
    header("Content-length: ".filesize($file));
    header("Content-disposition: attachment; filename =\"".basename($file)."\"");
    readfile("$file");
     
    ternto333, Jul 23, 2007 IP
  2. KalvinB

    KalvinB Peon

    Messages:
    2,787
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Check the memory limits in the INI file and also make sure that it's not just timing out.
     
    KalvinB, Jul 23, 2007 IP
  3. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Check max file limit in php.ini

    ALso, apache timeout has 300 seconds. Is your server on a slower port like 5 mbit or so?
     
    inworx, Jul 30, 2007 IP