function setval() { var url = window.location.toString(); url.match(/\?(.+)$/); var params = RegExp.$1; var params = params.split("&"); var queryStringList = {}; for(var i=0;i<params.length;i++) { var tmp = params[i].split("="); var acc_usr=tmp[1]; document.getElementById('pusr').value = acc_usr; } } <body onload = "setval();"> <FORM ENCTYPE="multipart/form-data" ACTION="/cgibin/fupload.cgi" METHO +D="POST"> <TABLE BORDER=0 WIDTH="550"> <TR> <TD ALIGN=RIGHT> File Name: </TD> <TD> <INPUT TYPE="File" NAME="filetoupload01" SIZE="70"> </TD> </TR> <TR> <TD COLSPAN=2>&nbsp;<BR></TD> </TR> <TR> <TD ALIGN=RIGHT> <INPUT TYPE="Submit" onclick="ValidateFilename(filetoupload01.value)" +VALUE="UPLOAD FILE"> <INPUT TYPE="HIDDEN" NAME="filetoupload02" VALUE=""> </TD> <TD ALIGN=RIGHT > <INPUT TYPE="RESET" VALUE="RESET FORM"> <INPUT TYPE="hidden" name="pusr" value="" /> </TD> </TR> </TABLE> </FORM> </body>

the following is the code in fupload.cgi

my %ufiles; foreach $key (sort {$a <=> $b} $query->param()) { next if ($key =~ /^\s*$/); next if ($query->param($key) =~ /^\s*$/); next if ($key !~ /^filetoupload_(\d+)$/); $Number = $1; if ($query->param($key) =~ /([^\/\\]+)$/) { $Filename = $1; $Filename =~ s/^\.+//; $ufiles{$Number} = $Filename; $File_Handle = $query->param($key);

i want to read the value of pusr thats coming from the html form and rename the uploaded file with the name of pusr value hope i am clear now :)


In reply to Re^2: y username is empty by sasidhardv
in thread y username is empty 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.