看板 Web_Design 關於我們 聯絡資訊
※ [本文轉錄自 PHP 看板] 作者: cyril63 (You belong to me) 看板: PHP 標題: [請益] download file 時間: Thu Jun 22 10:59:04 2006 以下download 檔案程式碼 其中 $file_dir => download file 的路徑 $d_file_name => download file 的檔案名稱(不含路徑) if(!$fdl=@fopen($file_dir,'r')) { die("Cannot Open File!"); } else { header("Cache-Control: ");# leave blank to avoid IE errors header("Pragma: ");# leave blank to avoid IE errors header("Content-type: application/X-MS-Excel"); header("Content-Disposition: attachment;filename=\"".$d_file_name."\""); header("Content-length:".(string)(filesize($file_dir))); sleep(1); fpassthru($fdl); } 問題是 執行的時候都會去download 成 這個php的名字 而不是 down file 的名字 (ex. 若這個phe script 是 down.php ,要download的名稱是test.xls 預計的情況應該是 download test.xls ,但實際上是down.php 而內容都是 test.xls的內容 只是檔名的問題 ) 請問這是什麼狀況 ? 該如何解決呢 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.163.20 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.163.20