[請益] 檔案下載給長度,只有Firefox不行
我要讓使用者下載檔案,於是我這樣寫:
<?php
$size=filesize($filename);
header("Content-Length: {$size} bytes");
header("Content-type: application/octet-stream; charset=big5");
header("Accept-Ranges: bytes");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Pragma: no-cache");
header("Expires: 0");
readfile($filename);
?>
這樣做的話在 IE 、Opera、 Chrome、Safari 都沒有問題
可是在 Firefox 2或3 卻有點小問題
下載時沒有顯示檔案大小,總是會等好久才會顯示下載完畢
我猜想似乎就是因為Firefox不知道檔案大小,所以總是要等到timeout才能判斷下載結束
可是我明明就有送 Content-Length 呀?而且其他瀏覽器都ok
請問是哪裡有寫錯?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.31.158
推
02/05 18:04, , 1F
02/05 18:04, 1F
→
02/05 23:00, , 2F
02/05 23:00, 2F
→
02/13 22:05, , 3F
02/13 22:05, 3F
推
02/13 23:30, , 4F
02/13 23:30, 4F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
0
18