bizerk Posted October 2, 2006 Share Posted October 2, 2006 Guys what should i do to make a Delete All function. Right now i have a list of all these files uploaded and a link under it saying DELETE FILE and when you click that it unlinks the . I want this to remain but have a new checkbox that says DELETE ALL, and making it unlink ALL files in that specific user directory.here is the code:[code]function delete($user_dat, $globalvars) { $split_imgname = explode('.', $_GET['delete']); if($split_imgname[1] == null) { echo "We shall have no directory deleting here."; $exitp = new template(); $exitp->exitp($user_dat, $globalvars); } if(unlink($user_dat['usrdir'] . "/" . $_GET['delete'])) { @unlink($user_dat['usrdir'] . "/thumbnails/" . $split_imgname[0] . ".gif"); echo "<i>" . $_GET['delete'] . "</i> has been deleted successfully. "; echo 'Click <a href="' . $_SERVER['PHP_SELF'] . '?action=imgdir">here</a> to go back.'; } else { echo "Could not remove the image because of unknown errors. "; echo 'Click <a href="' . $_SERVER['PHP_SELF'] . '?action=imgdir">here</a> to go back.';[/code] Link to comment https://forums.phpfreaks.com/topic/22804-adding-a-delete-all-function/ Share on other sites More sharing options...
tleisher Posted October 2, 2006 Share Posted October 2, 2006 Do an if to check if the check box is checked, then do a foreach loop to unlink. Link to comment https://forums.phpfreaks.com/topic/22804-adding-a-delete-all-function/#findComment-102755 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.