in reply to File Upload

You have a possible security hole here.

my $filename = " ../../asdf"; $filename =~ s/^.*[\\\/:]//; print $filename;

In other words, someone can submit a form with the filename containing a newline and possibly have some fun. I've not played around with tha too much, but it's worth considering. Instead, try a variant of:

my $_filename = $p->param('filename') || ''; my ($filename) = $_filename =~ /(\w+)$/; # only use word characters fr +om the end

Also, have you double-checked that the form in question used multipart-formdata encoding (or however you spell it)?

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re^2: File Upload
by rsiedl (Friar) on Jul 13, 2004 at 19:59 UTC
    thanks for the pointer on the security.

    Yep, using enctype="multipart/form-data".