2
這是我的文件下載下載力文件添加下劃線「_」來下載的文件名
的問題腳本,當下載一個文件,讓說,文件名是音樂,文件名更改爲
_var_www_myporject_module_Application_musicdir_music
我希望DONOT
這是段我的代碼
public function downloadAction() {
$filename = $this->params()->fromQuery('filename');
$file = "/var/www/myproject/module/Application/musicDir/$filename";
if ($file) {
header("Cache-Control: public");
header("Content-Description: File Download");
header("Content-Disposition: attachment;filename = $file");
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
readfile($file);
exit;
} else {
exit;
}
}
在大多數文件系統中,文件名不能包含斜槓。你偶然試圖建議一個「另存爲」目錄?你不能。 – 2013-03-07 09:41:18