Hi,

I just want do upload a file whithin my CGI-script.
But when I try to check the MIME-Type of the uploaded file, the script breaks.
Here are the relevant code lines:


use CGI qw/:cgi :form -private_tempfiles/;
my $cgi = new CGI;

our $fh = $cgi->upload('fileupload');
if (not $fh) {
        # ERROR-handling
}
my $filename = $cgi->param('fileupload');
my $type = $cgi->uploadInfo($filename)->{'Content-Type'};


The error I get:

Can't use an undefined value as a HASH reference at /.../cgi-bin/uploadtest.cgi line 90.


The method uploadInfo() internally reports the content of $cgi->{.tmpfiles}. But when I dump the hash-structure of $cgi I see that the key '.tmpfiles' is missing:


CGI-object:
  .charset =    ISO-8859-1
  .fieldnames
  .header_printed =     1
  .parameters = button,program,fileupload,screen
  .path_info =  
  .script_name =        /.../cgi-bin/uploadtest.cgi
  button =      Upload
  escape =      1
  program =     MathInd
  fileupload
 =      *Fh::fh00001AdressenPL_NGEE_MAT071207_rev.csv
  screen =      FineSelect


Whats going on there? What did I wrong?

Best Regards

Robert

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/


Reply via email to