Laravel FileNotFoundException thrown even though file exists
I believe your problem is here: $realPath = 'public/' . $filePath;
. You need full path to your upload folder, so try replacing it with public_path()."/".$filePath
.
I have fallen in the same situation recently, so here is a hint
Laravel after version 5 seems to allow dealing with files (get/put) only when using declared storage defined into filesystems.php
In that case the user must use 'local' or 'public' storage for getting the image or file stored. According to the code above, please do the following
- edit config/filesystems.php find local and make the following change
'local' => [
'driver' => 'local',
'root' => storage_path('app/local/common'),
],
- In order to read the file (ie 'image1.jpg') (get)
$afile = storage::disk('public')->get('image1.jpg');
In your case:
$realpath = 'image1.jpg'; //**Just the filename**
$image = Image::make(storage::disk('local')->get($realPath));
Hope this helps