Hi all, This is probably a stupid question, but I will ask any way..... I have a form to upload a file to a specific dir on the server. When I use POST for the method, instead of the file name, I get the contents of the file as the file name. If I use GET, I get the file name. Why? I don't really want to use GET since it shows the info in the URL. (security thing) By way of example, the file I am using as a test is called test1.txt. The file contains only one line "This is the test file" With my code, the file name becomes "This is the test file" This is driving me nuts..... Can anyone shed some light on this please? Thanks! Jim The code I am using for the form:
print "<FORM METHOD=\"post\" ENCTYPE=\"multipart/form-data\">\n"; print "<INPUT TYPE=\"FILE\" SIZE=\"25\" NAME=\"UPLOAD\">\n"; print "<input type=\"hidden\" name=\"login\" value=\"$login\">\n"; print "<input type=\"hidden\" name=\"password\" value=\"$password\">\n +"; print "<input type=\"submit\" value=\" Send File \">\n"; print "</FORM>\n";
The code I am using for the script:
$dir = '/Full/path/to/ul/dir'; $filename = $input{'UPLOAD'}; $filename =~ s/.*[\/\\](.*)/$1/; $fileUp = $dir.$filename; my $upload_filehandle = "$filename"; open UPLOADFILE, ">$dir/$filename"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE;

In reply to Upload form by JimJx

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.