gui*_*sen 1 php laravel laravel-4
我正在尝试管理我的文件上传,但似乎我无法写入该文件夹public/uploads.我有写权限,所以我不确定它是什么,有人看到错字吗?
我使用干预/图像库.
我的代码是:
$file = Input::file($fileName);
if ($file->isValid()) {
if ($file->getMimeType() == 'image/jpeg' || $file->getMimeType() == 'image/png') {
$path = public_path("uploads", $file->getClientOriginalName());
Image::make($file->getRealPath())->resize(180, null)->save($path);
} else {
throw new FileException;
}
}
Run Code Online (Sandbox Code Playgroud)
抛出的异常是:
Intervention \ Image \ Exception \ NotWritableException
Can't write image data to path (/home/vagrant/Sites/cms/public/uploads)
我发现了错字......
我有:
$path = public_path("uploads", $file->getClientOriginalName());
变成:
$path = public_path("uploads/" . $file->getClientOriginalName());
谢谢你的快速回答!
| 归档时间: |
|
| 查看次数: |
1875 次 |
| 最近记录: |