While I'm not a member of the CGI police (but you should look into CGI.pm itself, and compare your query grab with it's), I do have a comment.
my $file = $FORM{file};
$file =~ s{.*/}{}; # remove any path, this takes care of the ../.. sec
+urity problem
$file =~ s/[^\w\-.]//g; # remove anything in the filename that isn't a
+ word character, a dash, or a dot. This takes care of the `rm -rf /`
+type threats.
...
My view on the CGI.pm fascists is, YES you should use CGI.pm until you understand what the differences are. But including bloated modules in your code may, or may not, be a good idea. It depends, as things do, on context. For your usage, probably CGI.pm is a good idea. But if you were optimizing to keep the webservers memory usage low under heavy load, then CGI.pm might not be as good.
--
Snazzy tagline here
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.