php - Call to undefined method CakeResponse::file() -


i want download file after request completed using method public function sendfile($id) {

$this->response->file($id, array('download' => true, 'name' => 'postnet')); //return reponse object prevent controller trying render view return $this->response; } 

but error call undefined method cakeresponse::file() . should include class or cakeresponse or it's included already? thanks

i think you're working cakephp version doesn't suppose $this->response->file() method. if need use cakephp media view download file.

note:

for $this->response->file() first parameter complete path file location. example:

$this->response->file(                       www_root.'files/'. 'somename.ext', // full path file                       array('download' => true, 'name' => 'somename')                   ); 

nothing include additionally cakeresponse::file().


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -