我现在已经挣扎了一个小时试图解决这个问题。我用它来下载文件app/uploads/
目录。它说目录未找到或不可读。但我检查了它,它也存在使用的文件$file['File']['filename']
。我想知道我在这里缺少什么。?
$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;
确保您没有其他名为 File 的模型。如果是这样 - 它显然会覆盖 cakephp 的核心实用程序/文件模型。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)