我正在使用laravel 5.3.30并使用图像干预助手上传图像。上传图像时,出现错误“Image.php 143行中的NotWritableException:无法将图像数据写入路径(/ home/test/Desktop/Laravel/blog/public/images /)”。我已经为目录设置了适当的权限,但仍然无法上传图片。无法在Laravel上载图像
代码上传图片文件:
if($request->hasFile('featured_image')){
$image = $request->file('featured_image');
$filename = time().'.'.$image->getClientOriginalExtension();
$location = public_path('images/', $filename);
Image::make($image)->resize(800,400)->save($location);
$post->image = $filename;
}
我在网上查了解决方案,但没有它的工作。请纠正我,如果我做错了什么。提前致谢。
错误:NotWritableException在Image.php行143:无法写入图像数据到路径(/ home/test/Desktop/Laravel/blog/public/images /)“上传图片 – vivek321
只是为了确认,图片目录已经存在,对吗? – camelCase
@camelCase - 是的,它已经存在 – vivek321