上传图片时,getRealPath()
总是返回false
:
$image_file = $request->file('image_file');
$image_file->getRealPath(); // ---> FALSE
这是dd($image_file);
的结果:
此外,当我尝试将其与图像干预一起使用时:
$image_file = $request->file('image_file');
Image::make($image_file->getRealPath())->.....
我收到以下错误:
NotReadableException in AbstractDecoder.php line 323: Image source not readable
显然是因为 getRealPath()
返回 false
...有人已经问过这个问题:getRealPath returning false (Image Intervention and Laravel 5.1) ...但没有解决方案。
你知道为什么会发生这种情况吗?我该如何解决这个问题?
最佳答案
问题出在 php.ini 中 - 上传目录不正确。
关于php - getRealPath() 返回 false(Laravel 5.2 和图像干预),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41900565/