I need to store images uploaded in a form, store the image in public/uploads
folder and save the file name in database, and then need t show the uploaded files.
I successfully, uploaded the files to public/uploads
folder but the problem it stored with a unique name generated and the name I stored in db is the original name.
....
$post_images->image_file_name = $image->getClientOriginalName();
Storage::disk('uploads')->put('prefix_'.$post_id, $image);
$post_images->save();
and while showing in view,
<img src="{{url('/uploads')}}/prefix_{{$images->post_id}}/{{$images->image_file_name}}">
the url forms for the original file name(public/uploads/some_id/my_original_file_name.png
), but in public/uploads/some_id/unique_name.png
has with unique name.
How do I get the unique name for the file uploaded and save it in database? Or any other way to achieve this?