****************** 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;