##
****************** Upload4s.cgi
#!/usr/bin/perl --
$|=1; #Switch off buffering.
use CGI qw( :standard );
use Fcntl qw( :DEFAULT :flock);
use constant UPLOAD_DIR => '../user';
use constant BUFFER_SIZE => 16_384;
use constant MAX_FILE_SIZE => 1_048_576;
use constant MAX_DIR_SIZE => 100 * 1_048_576;
use constant MAX_OPEN_TRIES => 2;
$CGI::DISABLE_UPLOADS = 0;
$CGI::POST_MAX = MAX_FILE_SIZE;
my $q = new CGI;
print $q->header, $q->start_html, $q->Dump;
$q->cgi_error and error( $q, "Error transferring file: " . $q->cgi_error );
my $file = $q->param("file") || error ($q, " No file received.");
my $filename = $q->param("filename") || error ($q, " No filename entered.");
my $buffer = "";
$tmp="../user/$filename";
open(OUTPUT, ">$tmp") or die ("Cannot open upload file");
binmode OUTPUT;
open(FH,$q->tmpFileName($file)) or die ("eeeek dead");
while (read( FH, $buffer, 1024) ) { #FH
print OUTPUT $buffer;
}
close OUTPUT;
close FH;
####
Untitled Document
####
#!/perl/bin/perl
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use LWP::Debug qw(+);
my $ua = new LWP::UserAgent;
my $req = POST 'http://www.perfectmotion.co.uk/upload4s.cgi',
[ filename => '111', file => 'C:\test.bat? ];
# print $req;
my $res = $ua->request($req);
print $res->as_string;