I have an image within the public/badges directory called 1.png - I am trying to use the Storage library in laravel but keep getting the following error even though the file does exist at that location:
FileNotFoundException in Filesystem.php line 381:
File not found at path: Users/gk/Sites/mysite/public/badges/1.png
$filePath = 'badges/1.png';
$path = public_path()."/".$filePath
Form Laravel 5.2 documentation:
When using the local driver, note that all file operations are relative to the root directory defined in your configuration file. By default, this value is set to the storage/app directory.
So You are looking for file in:
Error is quite confusing.
'disks' => [ //... 'local_public' => [ 'driver' => 'local', 'root' => public_path(), ], //... ],
$filePath = 'badges/1.png'; $content = Storage::disk('local_public')->get($filePath); dd($content);