Dec 10, 2019
4
Level 3
Image upload e
I'm setting up an website where users should be able to upload multi photos. They must also be able to delete the photos when editing their profile.
Any advice how to setup? Being so user friendly and stable as possible.
Thanks in advance.
Level 3
if($request->ajax()) {
$photo = Photo::find($request->photoId); //Get image by id or desired parameters
if(File::exists($destinationPath.$photo->file_name)) //Check if file exists
File::delete($destinationPath.$photo->file_name) //Delete file from storage
$photo->delete() //Delete file record from DB
return response('Photo deleted', 200); //return success
}
delete image like this or if user have those image path then remove those path from imahe column where you assign to image to user table.
Please or to participate in this conversation.