in reply to Reading a File Uploaded to a cgi script

i had to handle an uploaded resume in one of the scripts i wrote... i did it by hand, instead of using the CGI.pm upload feature... this is how i did it. ($FORM is a hash populated with all incoming form fields, grabbed via CGI.pm's param() func.)

My form looks a bit like this:
<FORM ACTION="apply.cgi" METHOD="POST" ENCTYPE="multipart/form-data"> Resume: <INPUT TYPE="FILE" NAME="resume">
and the parsing script:
if ($FORM{'resume'}) { #read in the resume's data my ($data,$size); while( $size = read( $FORM{'resume'}, $data, 1024) ) { $FORM{'resume_data'} .= $data; $FORM{'resume_size'} += $size; } }
$FORM{'resume'} contains the name of the uploaded file and $FORM{'resume_data'} contains the actual data uploaded

OR

you could simply write directly to a file with something similar to:
open (FH, ">/tmp/resume.$$") || die; while (<$FORM{'resume'}>) { print FH; } close (FH);



THE UNIX CAR: you have to rebuild the engine whenever you hang a new air freshener in the car.