When I try to compile your code at the command line, it complains very loudly:
c:> perl -Tc 889712.pl Status: 500 Content-type: text/html <h1>Software error:</h1> <pre>Global symbol &quot;$name&quot; requires explicit package name at + 889712.pl line 11. Global symbol &quot;$extension&quot; requires explicit package name at + 889712.pl line 11. Global symbol &quot;%allowedext&quot; requires explicit package name a +t 889712.pl line 15. Global symbol &quot;$extension&quot; requires explicit package name at + 889712.pl line 15. 889712.pl had compilation errors. </pre> <p> For help, please send mail to this site's webmaster, giving this error + message and the time and date of the error. </p> [Tue Feb 22 22:34:08 2011] 889712.pl: Global symbol "$name" requires e +xplicit package name at 889712.pl line 11. [Tue Feb 22 22:34:08 2011] 889712.pl: Global symbol "$extension" requi +res explicit package name at 889712.pl line 11. [Tue Feb 22 22:34:08 2011] 889712.pl: Global symbol "%allowedext" requ +ires explicit package name at 889712.pl line 15. [Tue Feb 22 22:34:08 2011] 889712.pl: Global symbol "$extension" requi +res explicit package name at 889712.pl line 15. [Tue Feb 22 22:34:08 2011] 889712.pl: 889712.pl had compilation errors +.
You are using strict (as you should), but you need to declare and initialize all your variables ($name, $extension). You created an array variable (@allowedext), but then tried to access it as if it were a hash.

See also Troubleshooting Perl CGI scripts


In reply to Re: extension check on upload script doesn't do anything by toolic
in thread extension check on upload script doesn't do anything by edwardra3

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.