#!perl # Store.pl: sits on a web server waiting to store a file. use CGI; open(LOG,">upload.log"); my $q=CGI->new(); $q->header(); $q->start_html(); my $client = $ENV{'REMOTE_ADDR'}; print LOG "Client: $client\n"; $file = $q->param("upload_file"); print LOG "File: $file\n"; $client =~ s/\./_/g; open(FH,"> c:/upload/$client.txt") or die($!); binmode FH; my $fh = $q->upload($file) or print LOG "Error uploading file $!\n"; print $fh; while (<$fh>) { print FH $_; } $q->end_html(); close(FH); close(LOG); #### use LWP::UserAgent; $URL_Server = $ARGV[0]; $fn = $ARGV[1]; my $ua = LWP::UserAgent->new(); my %fields = (upload_file => $fn); my $res = $ua->post("http://$URL_Server/cgi-bin/store.pl", \%fields, 'Content_Type' => 'multipart/form-data'); print $res->as_string;