A few observations:

The first line loops through the CGI parameter keys (assuming $query is a valid CGI.pm object or something similar). They're sorted numerically, which is odd, and possibly pointless.

The next line skips to the next key if this one is empty of anything but whitespace -- unlikely, and superseded two lines later by a more specific check.

The next line skips to the next key if this one's value is empty of anything but whitespace.

The next line skips to the next key if this one doesn't start with "filetoupload_" followed by one or more digits. If it does match that pattern, the digits are put in $Number by the next line and the loop proceeds on.

Then after a blank line, your 'if' line checks the value of this filetoupload_\d+ parameter, and if it doesn't end in a forward or backward slash, puts everything after the last slash in $1, which the next line puts into $Filename.

The next line puts $2 into $pxuser. But since there is only one set of capturing parentheses in the last regex, $2 will always be empty at this point, and thus so will be $pxuser. This is probably a problem.

You also talk about getting a "p_usr" value, as well as a "pusr" value, but your code doesn't do this, and these are also not interchangeable. Where do you expect "the user who has triggered the upload" value to come from? Are "pxuser", "p_usr", and "pusr" three different things, or the same thing inconsistently typed?


In reply to Re^3: help on this code below by aaron_baugher
in thread help on this code below by sasidhardv

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.