Help for this page

Select Code to Download


  1. or download this
    use CGI;
    use File::Basename;
    ...
    my $fullfilename = $cgi->upload("file");
    
    my ($filename, $type) = split '\.', basename($fh);
    
  2. or download this
              # untaint filename and type
    $filename =~ s/[^A-Za-z0-9_-]//g;
    ...
         print FILE $uploaded;
    }
    close FILE or die "$!";
    
  3. or download this
    my $fullfilename = $cgi->upload("file");
    
    my $filename = reverse((split(/\//,                
                                 reverse($fullfilename)))[0]);