Hi all,

I'm trying to attach uploaded files to outgoing email, but I can't get the
mime-type of the uploaded file with the 'uploadInfo' method: it always
returns null.

Here's the code (error checking removed for clarity):

foreach ( keys %ARGS ) {

   my $upload_name = $_;

  # uploads always named 'Attachment1', 'Attachment2', etc.
  next unless $upload_name =~ /Attachment/;

   # this works
  my $query = $m->cgi_object;

   # this works
   my $filename = $query->param($upload_name);

   # this DOESN'T work
  my $hashref = $query->uploadInfo($upload_name);
   my $type = $hashref->{'Content-Type'};

   # this works
   my $data;
  my $fh = $query->upload($upload_name);
  while (<$fh>) {
     $data .= $_;
  }

   # MIME::Entity object already exists
  $entity->attach( Filename => $filename,
                    Type     => $type,
                    Data     => $data

                   );
}


So it seems that the 'param' and 'upload' methods work on the cgi_object,
but not 'uploadInfo'. I see posts in the list archives about this problem
from years ago, but no solution.

I'm using Mac OS X 10.5.7, Mason 1.4, CGI.pm 3.42, Apache 2.2, mod_perl
2.0.2, Perl 5.8.8.


-- 
Michael R. Boudreau
Senior Publishing Technology Analyst
The University of Chicago Press
1427 E. 60th Street
Chicago, IL 60637
(773) 753-3298    fax: (773) 753-3383



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to