I am trying to use the following script to upload files from a WinXP client to a Win32 server.
#!/local/bin/perl
use CGI;
my $cgi = new CGI;
my $file = $cgi->param('uploadfile');
$file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the fil
+ename
my $name = $2;
open(LOCAL, ">$name") or die $!;
while(<$file>) {
print LOCAL $_;
}
print $cgi->header();
print "$file has been successfully uploaded... thank you.\n";
The problem I'm having is that when the local file on the WinXP client is written to the server it is always 0 (zero) length i.e. the filename gets created but no data gets written to the remote file. I've tried a similiar script from the PERL Cookbook using sysopen and I get the same result.
Not sure what's going on but any help/advice would be much appreciated.
Thanks
Eoin
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.