2014-01-29 22 views

回答

0

尋找代碼,我認爲它在大型文件由於內存限制失敗。腳本在發送之前通過file_get_contents()在內存中讀取整個文件。我懷疑,> 1Gb文件導致內存問題。 嘗試在腳本的download.php替換以下行:

  //get the file content 
      $strFile = file_get_contents($strDownload); 

      //set the headers to force a download 
      header("Content-type: application/force-download"); 
      header("Content-Disposition: attachment; 

filename=\"".str_replace(" ", "_", $arrCheck['file'])."\""); 

        //echo the file to the user 
        echo $strFile; 

到:

header('Content-Description: File Transfer'); 
    header('Content-Type: application/octet-stream'); 
    header('Content-Disposition: attachment; filename='.basename($strDownload)); 
    header('Content-Transfer-Encoding: binary'); 
    header('Expires: 0'); 
    header('Cache-Control: must-revalidate'); 
    header('Pragma: public'); 
    header('Content-Length: ' . filesize($strDownload)); 
    ob_clean(); 
    flush(); 
    readfile($strDownload); 

這可能幫助。從手動

注:ReadFile的()不會出現內存問題,甚至發送大文件時,對自己

+0

謝謝,但沒有幫助...小文件下載罰款,但在大的情況下,顯示文件未找到 – user3249713