Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Button to delete a file

    Hi members,
    I need some help with providing a button or hyperlink to delete a file using cgi and perl. unlink will delete a file in perl but I am not sure on how to use it inside the cgi code. Also, it would be nice if we can throw a confirmation dialog before deleting. Any inputs into this are greatly appreciated.

    Thanks in advance.

  • #2
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    what code have you got already?

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #3
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    <form action=./do_delete_task.cgi method=post>
    </form>

    file do_delete_task.cgi contains the following code:
    #!/usr/local/bin/perl
    use CGI;
    use strict;
    use warnings;
    require "./helper.pl";
    require "./cgi-lib.pl";
    my $xmlfile = './xml/task_' .$task_id .'.xml';
    MAIN:
    {
    printPageHeader();
    move($xmlfile,'./xmlarchive/task_' .$task_id .'.xml');
    }

  • #4
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,879
    Thanks
    2
    Thanked 164 Times in 159 Posts
    It's unclear to me if you're asking about the html code to make a button, or the Perl code to parse the form and delete the file.

  • #5
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I am asking for a html button to delete a file

  • #6
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,879
    Thanks
    2
    Thanked 164 Times in 159 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •