问题
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