where $fh was simply the name of the uploaded file.I don't think so. From the doc:
perldoc -f read
read FILEHANDLE,SCALAR,LENGTH,OFFSET
read FILEHANDLE,SCALAR,LENGTH
Attempts to read LENGTH *characters* of data into variable
SCALAR from the specified FILEHANDLE...
You must have got the filehandle from somewhere.
Note that upload takes the name of the file, not the name of the parameter which holds the filename.Update: Scratch last sentence. It is not true for
$cpi->upload. See
Bloodnok's post below.