getRealPath() returns false (Laravel 5.2 & Image I

2019-08-02 18:05发布

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);:

enter image description here

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条回答
时光不老,我们不散
2楼-- · 2019-08-02 18:25

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

查看更多
登录 后发表回答