[請益] Header 無法下載wma的問題

看板PHP作者 (小狼)時間15年前 (2011/02/08 22:06), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
大家好,爬了版上跟google了一些header的用法。不過我在下載pdf檔案都沒問題 雖獨wma檔會出現下載0k的檔案這種情況,不知道有沒有人碰過@@? 我的程式如下: 法一: header("Content-type: text/plain"); header("Content-Disposition: attachment; filename=$file"); 法二: 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)); ob_clean(); flush(); readfile($file); exit; 法三: 這個方法我有手動指定Content-Type wma的type是用audio/x-ms-wma 不知有沒有錯~"~ header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()).' GMT'); header('Pragma: no-cache'); header('Content-Encoding: none'); header('Content-Disposition: '.'attachment'.'; filename='.$file_name); header('Content-type: '.$file_type); header('Content-Length: '.filesize( $file_path_on_server )); $downcontent=file_get_contents( $file_path_on_server ); echo $downcontent; -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.122.184.111 ※ 編輯: SyaoranX 來自: 140.122.184.111 (02/08 22:08)
文章代碼(AID): #1DKKtgqq (PHP)
文章代碼(AID): #1DKKtgqq (PHP)