my $q = CGI->new; my $filename = $q->param('file_field_name'); my $metadata = $q->fileInfo($filename); my $mimetype = $metadata->{'Content-Type'};