2010-05-25 71 views
1

雹,我有一個問題,用PHP服務文件到客戶端。當我想下載它時,保存並打開對話框將會出現,但下載的進度將不會顯示。我的問題是什麼?互聯網瀏覽器6 PHP服務文件問題

頭,我將其發送到客戶端:

header('Content-Type: '); 
header('Content-Description: File Transfer'); 
header('Accept-Ranges: bytes'); 
header('Content-Transfer-Encoding: binary'); 

保存對話框

HTTP://vzz.ir/files/kn5gsecfnoia1cqkfop6.jpg

進展IP不顯示。

HTTP://vzz.ir/files/88ruak7ocjgn10ha9mda.jpg

回答

0

應設置與文件大小的頭,使進度條出現。內容類型也應該被指定,使用application/ocet-stream用於未知的MIME類型(或強制下載)。

header('Content-Type: application/ocet-stream'); 
header('Content-Disposition: attachment; filename=test.dat'); 
header('Content-Length: '.filesize('test.dat')); 
header('Content-Description: File Transfer'); 
header('Content-Transfer-Encoding: binary'); 
header('Accept-Ranges: bytes'); 
readfile('test.dat'); 
exit; 
+0

這兩個主題都受影響,但進度問題仍然存在。 :( – sweb 2010-05-25 20:36:04