in reply to Mime types.

Also, does anyone know if there is a way to provide a filehandle instead of a path to the file...

According to 'perldoc CGI':
The filename returned is also a file handle. You can read the contents of the file using standard Perl file reading calls:
# Read a text file and print it out while (<$filename>) { print; } # Copy a binary file to somewhere safe open (OUTFILE,">>/usr/local/web/users/feedback"); while ($bytesread=read($filename,$buffer,1024)) { print OUTFILE $buffer; }
And you can get the MIME type, too.
$filename = $query->param('uploaded_file'); $type = $query->uploadInfo($filename)->{'Content-Type'};

Replies are listed 'Best First'.
RE: RE: Mime types.
by Punto (Scribe) on Jun 19, 2000 at 02:20 UTC
    >$type = $query->uploadInfo($filename)->{'Content-Type'};

    I get "Can't use an undefined value as a HASH reference" with that code.. Any idea what it is?

    Thanks..

      Maybe $filename is undef. Did you actually get a file?