I'm afraid now an hour, trying to fix it. I used this to download a file from a directory app/uploads/. He says the directory was not found or not readable. However, I checked it, and there was a file using it $file['File']['filename']. I want to know what is missing here.
$file = $this->File->findById($id);
$extension = pathinfo($file['File']['filename'],PATHINFO_EXTENSION);
$this->response->file('uploads'.DS.$file['File']['filename'], array(
'download' => true,
'id' => $file['File']['filename'],
'name' => $file['File']['filename']
));
$this->response->type($extension);
return $this->response;
source
share