看板 [ PHP ]
討論串[請益] 使用header下載的檔案與原檔不一樣
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者tkdmaf (皮皮快跑)時間14年前 (2011/12/03 22:42), 編輯資訊
0
0
0
內容預覽:
下面這段我忘記從那弄到的。. 然後就封進我的下載函式了,參考看看。. $truename = '要還原成下載使用的檔名';. $filename = '路徑/真實存在的檔名';. $filesize = filesize($filename);. header('Pragma: public');.
(還有463個字)

推噓0(0推 0噓 3→)留言3則,0人參與, 最新作者saponevol23 (saponevol23)時間14年前 (2011/12/03 21:34), 編輯資訊
0
0
0
內容預覽:
程式碼如下:. header("Content-type: ".filetype("$file"));. header("Content-Disposition: attachment; filename=".$filename."");. readfile($file);. $file為檔案路徑.
(還有51個字)
首頁
上一頁
1
下一頁
尾頁