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] Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.