upload - How can I check the MIME type of an uploaded file using Perl CGI? -
i'm trying mime type of <input type="file" />
element using perl, without examining contents of file itself, in other words, using http headers.
i have been able "multipart/form-type" content-type value, understanding each element own mime type?
how can see sub-mime types using perl?
i assume using cgi.pm this. if using oo interface cgi can this.
use strict; use warnings; use cgi; $cgi = cgi->new; $filename = $cgi->param('upload_param_name'); $mimetype = $cgi->uploadinfo($filename)->{'content-type'};
if using procedural interface, equivalent be:
use strict; use warnings; use cgi qw/param uploadinfo/; $filename = param('upload_param_name'); $mimetype = uploadinfo($filename)->{'content-type'};
Comments
Post a Comment