Jump to content

Adding a Delete All Function


bizerk

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.