I’m learning and tried to follow a bunch of guides but I just can’t seem to store it in the right directory if at all.
So my storage structure is like this:
storage -> app-> public -> books
Please tell me how I can store an image named $isbn in the ‘books’ folder like storage -> app-> public -> books -> $isbn.jpg
Thank you.
I tried:
$image = $request->file('imgInp');
Storage::disk('local')->put('books/'.$isbn, $image, 'public');
All this did was store the image (that is not named $isbn) like storage -> app-> books -> $isbn -> image_with_weird_name.jpg.
3
Answers
Try this:
Or:
try this
You can use getClientOriginalExtension() method to get the extension of the original file and concatenating it with the $isbn to form the filename.