2012-05-21 114 views
0

我已經編寫了下載音頻文件的代碼。當我嘗試通過PHP下載超過50MB的文件時,它不會完全下載。它下載最多45MB。每次我嘗試下載時,下載大小從36MB到45MB不等。文件未完全下載

我已經在php.ini改變了配置如下:後

memory_limit 512M 
post_max_size 512M 
upload_max_filesize 512M 

phpinfo(),其顯示上述值I更改配置。但我仍然有同樣的問題。

我用下面的代碼來下載:

<?php 
$file = "file to download"; 
header('Content-Description: File Transfer'); 
header('Content-Type: application/octet-stream'); 
header('Content-Disposition: attachment; filename='.basename($file)); 
header('Content-Transfer-Encoding: binary'); 
header('Expires: 0'); 
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
header('Pragma: public'); 
header('Content-Length: ' . filesize($file)); 
readfile($file); 
?> 

幫助我解決這個

感謝

+0

我曾經有下載問題,檢查出可能包含有用信息的問題,以幫助您解決它:http://stackoverflow.com/questions/9944869/forced-file-download-iscorrupted –

+0

如果您下載65MB文件,下載軟件(瀏覽器或下載加速器)是否顯示進度並在35MB時完成(100%)? –

+0

好吧,我會嘗試,因爲你建議Ayesh Karunaratne –

回答

0

任何人有這樣的想法?我使用下載管理器來下載文件。當它達到65%時顯示錯誤信息爲「數據傳輸已中斷,服務器不支持恢復,只能從頭開始下載」..

如何解決這個問題?