Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
XP is just a number
 
PerlMonks  

RE: Mime types.

by le (Friar)
on Jun 18, 2000 at 08:31 UTC ( [id://18706]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 18, 2000 at 22: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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://18706]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.