How to download files in Cakephp?

0

I have the path of an image saved in my bank. I would like to put a button in my view to download this image. How to do?

    
asked by anonymous 06.01.2015 / 14:59

1 answer

2

You can use file() method of object < strong> response for this. So:

$this->response->file(
    $file['path'],
    array('download' => true, 'name' => 'foo')
);
    
06.01.2015 / 15:33