When a file with a Content-Type that isn’t text/html is uploaded to this CGI script, its output indicates that only HTML types are allowed.#!/usr/bin/perluse strict; use CGI ...
#!/usr/bin/perl use strict; use CGI qw/:standard/; my $q = new CGI; my $filename = $q->param('uploaded_file'); my $contenttype = $q->uploadInfo($filename)->{'Content-Type'}; print header; print start_html; print "Type is $contenttype"; print end_html;
To write to a filehandle, place the filehandle after the print function call.open (NEWFILE, ">/tmp/thenewfile"); print NEWFILE "Printing to the new file ...