if ($query_string =~ /upload/) {
(my $upload, my $fileshare_directory) = split ('&',$query_string);
(my $stuff, $fileshare_directory) = split ('=',$fileshare_directory);
if ($upload eq "upload=get") {
####################################
#
# This is the situation if the script is called from the file list
#
####################################
print start_multipart_form(-action=>'/cgi-bin/xi_fileshare.cgi'),
hidden (-name=>'upload', -value=>'upload'),
hidden (-name=>'fileshare_directory', -value=>'$fileshare_directory'),
filefield(-name=>'file_upload', size=>60),
br,
submit(-label=>'Upload File'),
end_form;
} else {
####################################
#
# This is when it's called with a file upload
#
####################################
my $length;
print "Query:$query_string
\n";
my $file = param('file_upload');
if (!$file) {print "Ain't no file!
\n"; exit;}
print h2 ('File Name:'),$file;
print h3('File MIME TYPE:'),
uploadInfo($file)->['Content-Type'];
while (<$file>) {
$length += length ($_);
}
print h3('File Length:'),$length;
}
exit;
}