Subject: | CGI Documentation issue versus 3.49 code behaviour |
Date: | Mon, 24 Sep 2012 16:31:27 +0100 |
To: | <bug-cgi [...] rt.cpan.org> |
From: | Chris Jack <chris_jack [...] msn.com> |
I'm using perl 5.12.1 with version 3.49 of CGI.pmI was attempting to get more information about a file I was uploading and tried to follow the documentation at:http://search.cpan.org/~lds/CGI.pm-3.50/lib/CGI.pm#PROCESSING_A_FILE_UPLOAD_FIELD which reads: $filename = param('uploaded_file');
$type = uploadInfo($filename)->{'Content-Type'};
unless ($type eq 'text/html') {
die "HTML FILES ONLY!";
}I tried various variations on this but uploadInfo($filename) was always returning undef. After a bit of fiddling, I got it to work by changing the first line to use upload rather than param aka: $filename = upload('uploaded_file');
$type = uploadInfo($filename)->{'Content-Type'};
unless ($type eq 'text/html') {
die "HTML FILES ONLY!";
}This worked. Thought you might like to think about changing the documentation.Regards Chris