Ever since my first contact with MediaView, I've had issues. My biggest complaint of course is the need for the MIME type array mapping used in it. If you haven't read it already, see why MediaView is a bleeding bastard.
In essence, DownloadView is just a MediaView ripoff, I've simply removed everything unnecessary for download and modified the params. Anyway, I believe that DownloadView will make your life a bit easier downloadwise. This is how you use it:
// in your controller
$fileName = 'FileNameYouWantTheUserTo.See';
$file = new File('fullpath/to/the/file');
$this->view = 'download';
$this->set(compact('file', 'fileName'));
...or...
// in your controller
$fakeFile = new File('FileNameYouWantTheUserTo.See');
$file = new File('fullpath/to/the/file');
$this->view = 'download';
$this->set(compact('file', 'fakeFile'));
And..well, that pretty much does it. Just drop download.php in your ~/views folder and you're ready to go.
DownloadView is available for download here:
Comments & suggestions are always welcome ;-)


Article comments — View · Add
Does it works with the last release of Cakephp ?
Media View work wih Firefox and Internet Explorer but not with Chome !
Can you help me ?