I have a form designed for uploading multiple text files and therefore I have set the mime type in the HTML form to
enctype="multipart/form-data"
I am using the following script
#!/usr/bin/env perl -wT
use strict;
use warnings;
use open qw(:std :encoding(UTF-8));
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new();
However, there is a chance that people will upload a gzip file. I would like to protect against it, but when I upload a gzip file the script crashes as soon as the new CGI object is made with this error message in httpd error_log.
...
test.cgi: utf8 "\\xA3" does not map to Unicode at (eval 16) line 5.
test.cgi: utf8 "\\xB5" does not map to Unicode at (eval 16) line 5.
test.cgi: Malformed multipart POST
How am I meant to enable uploading multiple plain text files and not die when someone uploads a gzip file?