getRealPath() returns false (Laravel 5.2 & Image Intervention)

*爱你&永不变心* 提交于 2019-12-11 04:18:42

问题


When uploading images, getRealPath() always returns false:

$image_file = $request->file('image_file');
$image_file->getRealPath(); // ---> FALSE

Here is the result of dd($image_file);:

Also, when I try to use it with Image Intervention:

        $image_file = $request->file('image_file');

        Image::make($image_file->getRealPath())->.....

I am getting the following error:

NotReadableException in AbstractDecoder.php line 323: Image source not readable

Obviously because getRealPath() returns false... Someone has already asked about this problem: getRealPath returning false (Image Intervention and Laravel 5.1) ... but there is no solution.

Do you know why is this happening, how can I fix this?


回答1:


The problem was in php.ini - incorrect upload dir.



来源:https://stackoverflow.com/questions/41900565/getrealpath-returns-false-laravel-5-2-image-intervention

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!