#### # Delete File #### sub delete_file { my $query; # check for tainted data my $files = $q->param( "files") || error( $q, "couldn't read File valu +es"); $files =~ /^([\/.\w.]+)$/; # The "untainted" file is now in $1 $files = $1; die "Bad filename" unless $files; print<<HTML; <html> <head> <meta http-equiv="content-type" content="text/html;charset=ISO +-8859-1"> <title>Upload - File Deleted</title> </head> <body bgcolor="#ffffff"> <form action="upload.cgi" Method="post" ENCTYPE="multipart/form-da +ta"> <P>File(s) Have Been Deleted: <INPUT TYPE="HIDDEN" NAME="drt" VALUE="uploads2"> <br> HTML foreach ($q->param("files")){ unlink($_); } print<<HTML; <br> <INPUT TYPE="submit" NAME="action" VALUE="Back To Main +"> </FORM> <p></p> <!-- trying to get dir_files to print here --> HTML } #### end of delete file #### # Get File List #### sub get_file_list { my $drt = $q->param( "drt") || error( $q, "couldn't get drt value"); $drt =~ /^([\w.]+)$/; # The "untainted" file is now in $1 $drt = $1; die "Bad filename for value drt" unless $drt; #opendir(DIR,$dfiles); #my @files = grep { $_ ne '.' && $_ ne '..' } readdir(DIR); #closedir(DIR); my @files=glob("/Library/WebServer/Documents/userpages/$drt/*.*"); print<<HTML; <html> <head> <meta http-equiv="content-type" content="text/html;charset=ISO +-8859-1"> <title>Upload - Delete Files</title> </head> <body bgcolor="#ffffff"> <form action="upload.cgi" Method="post" ENCTYPE="multipart/form-da +ta"> <P>List of Files: <br> <INPUT TYPE="HIDDEN" NAME="drt" VALUE="uploads2"> HTML foreach (@files) { print "<br> Delete this File: $_ <INPUT TYPE=\"checkbox\" NAME=\"files +\" VALUE=\"$_\">\n"; } print<<HTML; <br> <br> <INPUT TYPE="submit" NAME="action" VALUE="Remove File( +s)"> </FORM> HTML } ### end of get file list
In reply to Re: Re: Allow User to Select Which Files to Delete
by lex2001
in thread Allow User to Select Which Files to Delete
by lex2001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |