After going through a lot of documentation I am able to save an image in Laravel.
But now I am getting an error that every time I save the image it got saved in a separate folder created for that image.
So if I save an image it got saved like
http://localhost/storage/uploads/phpAC6E.tmp.jpg/gedmQBjYgGecrqiuJol6wQs0BKkkMuCko91opWvi.jpeg
Notice the folder phpAC6E.tmp.jpg got created automatically.
The question here is not what I am looking for.
I don't know where I am going wrong I had tried many things but it doesn't work. Below are my code snippets :
filesystem.php configuration-
'local' => [
'driver' => 'local',
'root' => storage_path('app/public/uploads'),
'url' => env('APP_URL').'/storage/uploads',
'visibility' => 'private',
],
My controller function-
public function save(Request $request){
$file = $request->file('image');
$ext = $file->getClientOriginalExtension();
$path = Storage::disk('local')->put($file->getFilename().'.'. $ext, $request->file('image'));
return Storage::url($path);
}
The folders have been created like this.