tcox has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI Uploading Trouble
by howie (Sexton) on Nov 10, 2004 at 23:28 UTC | |
|
Re: CGI Uploading Trouble
by fglock (Vicar) on Nov 10, 2004 at 19:36 UTC | |
|
Re: CGI Uploading Trouble
by xorl (Deacon) on Nov 10, 2004 at 19:53 UTC | |
|
Re: CGI Uploading Trouble
by steves (Curate) on Nov 10, 2004 at 20:23 UTC | |
|
Re: CGI Uploading Trouble
by zentara (Cardinal) on Nov 11, 2004 at 14:17 UTC |