これはファイルをダウンロードするための私のスクリプトです
問題は、ファイルをダウンロードするときに、ファイル名が音楽であると言うと、ファイル名が次のように変更されることです。
_var_www_myporject_module_Application_musicdir_music
私が望んでいない
これは私のコードのスニペットです
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;
}
}