Zend Framework 1 を使用してファイルをダウンロードしたいと考えています。ファイルは現在ローカル ディスクにあります。
私の downloadAction は次のようになります。
public function downloadAction() {
header('Content-Type: some/contentType');
header('Content-Disposition: attachment; filename="myFile.ext"');
readfile('path/to/myFile.ext');
// disable layout and view
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
}
( http://www.stoimen.com/blog/2010/05/25/download-files-with-zend-framework/も参照)
magic_mime モジュールまたは fileinfo モジュールをインストールせずに、ファイルの自動 MIME 検出を追加することは可能ですか?