【问题标题】:Image upload error in LaravelLaravel 中的图片上传错误
【发布时间】:2017-09-09 14:20:21
【问题描述】:

我正在尝试将图像上传到数据库,但它给了我:无法将图像数据写入路径 (/Applications/XAMPP/xamppfiles/htdocs/agrohelp/public/uploads/buletine/1504966392.jpeg)" 错误

代码如下:

$buletin=$request->file('buletin');
$filename = time().'.'.$buletin->getClientOriginalExtension();
Image::make($buletin)->resize(300,300)->save(public_path('/uploads/buletine/'.$filename)); 

$employee->buletin=$filename;

【问题讨论】:

  • 很可能是权限问题。您使用的是哪个操作系统?
  • 我正在使用 macOS Sierra
  • 授予 777 权限到您的 buletine 文件夹,它应该可以工作。
  • 如何给777权限?

标签: php image laravel


【解决方案1】:

然后尝试这样:

检查权限: - 许可图片/文章 777

Image::make($image->getRealPath())->resize(300,300)->save('public/uploads/bulentine'.$filename);

这样授予权限:

使用CHMOD

对于您的递归文件

chmod -R 777 foldername or pathname

对于非递归文件

chmod 777 foldername or pathname

【讨论】:

  • chmod 777 thumbs
  • @Andrei .. Okz 很好...如果你得到答案,请竖起大拇指:)
猜你喜欢
  • 1970-01-01
  • 2015-02-19
  • 2018-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多