This is the script that invokes the server script:use strict; use CGI; my $q=CGI->new(); my $client = $ENV{'REMOTE_ADDR'}; my $buffer; my $file = $q->param('upload_file'); $client =~ s/\./_/g; open(FH,"> c:/upload/$client.txt") or die($!); my $fh = $q->upload('upload_file'); while (<$fh>) { print FH; } close(FH); close(LOG);
The output from the web server is:#!perl -w use LWP::UserAgent; use HTTP::Request::Common qw/POST/; my $ua= LWP::UserAgent->new(); my $filename= $ARGV[0]; chomp($filename); my $url='http://diesel.nci.nih.gov/cgi-bin/store.pl'; my %fields = ("upload_file" => "$filename"); my $results = $ua->post($url , content => [upload_file => "$filename"], enctype => 'multipart/form-data'); if($results->is_success){ print "It's good!\n"; } else { print "It didn't work.\n"; print $results->status_line(); }
The filename is create on the server but it is o bytes long. Does anyone have any ideas on why it isn't working? Any information is appreciated. tcox50:34 2004] [error] [client 156.40.134.176] Use of uninitialized value + in <HANDLE> at C:/Apache/scripts/store.pl line 19. [Wed Nov 10 13:50:34 2004] [error] [client 156.40.134.176] readline() +on unopened filehandle at C:/Apache/scripts/store.pl line 19.
In reply to CGI Uploading Trouble by tcox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |