in reply to Multiple File upload script

First, when uploading multiple files with a single POST, you must have a separate file param for each file:
<input type="file" name="file1">
Second, you get the remote filename with param. Then change this into the local filename.
my $filename = $cgi->param('file1');
Third, you get the filehande with upload:
my $fh = $cgi->upload('file1');
Fourth, get the uploaded Content-Type (has absolutely ntohing to do with the page's Content-Type) with uploadInfo
my $content_type = $cgi->uploadInfo($filename)->{'Content-Type'};
I would suggest writing a function that handles a single file upload. And then call it multiple times for each file param in the form.
upload_file('file1'); upload_fiel('file2'); sub upload_file { my ($param_name) = @_;