## pull the filename in a variable my $fname = $query->param('upload'); ## determine the file type via the headers my $info = $query->uploadInfo($fname); my $type = $info->{'Content-Type'};