Multimedia views have been deprecated since version 2.3. Instead, use File Upload .
Check out this minimal example in the controller:
public function download($id) {
$path = $this->YourModel->aMagicFunctionThatReturnsThePathToYourFile($id);
$this->response->file($path, array(
'download' => true,
'name' => 'the name of the file as it should appear on the client\ computer',
));
return $this->response;
}
$this->response->file APP. $this->response->file('someFolder' . DS . 'someFile.zip') APP/someFolder/someFile.zip.
" " CakePHP 2.0. .
CakePHP, Media Views, . Media Views (Cookbook).
:
public function download($id) {
$this->viewClass = 'Media';
$path = $this->YourModel->aMagicFunctionThatReturnsThePathToYourFile($id);
$params = array(
'id' => 'someFile.zip',
'name' => 'the name of the file as it should appear on the client\ computer',
'download' => true,
'extension' => 'zip',
'path' => $path
);
$this->set($params);
}