[請益] header download file變成PHP
各位大大
小弟不才 想請問
我現在有個頁面叫做download.php
程式碼如下
$file_name = "test.rar";
$file_path = "download/test.rar";
$file_size = filesize($file_path);
header('Pragma: publlic');
header('Expires:0');
header('Last-Modified: ' . gmdate('D, d M Y H:i ') . ' GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
//header('Content-Type: application/octet-stream');
header('Content-Type: application/x-rar-compressed');
header('Content-Length: ' . $file_size);
header('Content-Disposition: attachment; filename="' . $file_name . '";');
header('Content-Transfer-Encoding: binary');
readfile($file_path);
----------------------------------分行線---------------------------------
首先 我的檔案大小約1.XXG
我點選網頁下載檔案時
我連結不到我的download.php頁面
找不到檔案 http://xxx.xxx.xxx/download.php
當我將檔案換成另一個的時候
檔案大小大約為5XM
此時
找的到了
但是下載的檔案變成了download.php
而不是我所指定的test.rar
不知道為什麼會這樣
是因為下載檔案容量的問題嗎?
我被這個問題困擾好久了
希望各位大大能夠幫助我
剛剛把
header('Content-Type: application/x-rar-compressed');
變成
header('Content-Type: application/force-download');
可以成功的下載5Xm的檔案了
但是1.xxG的檔案還是找不到網頁
是因為檔案大小的問題嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.81.19.118
※ 編輯: angelmark 來自: 219.81.19.118 (05/13 17:00)
→
05/13 17:53, , 1F
05/13 17:53, 1F
→
05/13 18:30, , 2F
05/13 18:30, 2F
推
05/14 00:34, , 3F
05/14 00:34, 3F
→
05/14 00:36, , 4F
05/14 00:36, 4F
→
05/14 14:20, , 5F
05/14 14:20, 5F
→
05/14 19:24, , 6F
05/14 19:24, 6F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章