Welcome Guest, Not a member yet? Register   Sign In
Multiple delete image from database and folder too
#4

(02-05-2015, 09:53 AM)CroNiX Wrote: However, since he's doing multiple actions (delete from db AND delete corresponding image), I WOULD do them in a loop. What if there is a file permission error or something when deleting one of the images, but you've already deleted all entries from the DB?

If he's deleting a couple of rows at a time a loop is no problem and easy. But since he can select them all and if he had a ridiculous number of rows he selected to delete, I'm not sure I would loop through and query the database like that. I would personally delete each image from the folder first and if the delete was successful, add it to an array of ids and then delete all of the rows at once for only images that were deleted from the folder successfully.
Reply


Messages In This Thread
RE: Multiple delete image from database and folder too - by egall8 - 02-05-2015, 10:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB