Um, perhaps another thing. You're setting $type = $query->uploadInfo($filename)->{'Content-Type'}; and then checking $type against 'text/html'. But if your test source file ends in '.txt' then what is mapping it to be an HTML file? I would think the file coming in would consider itself text/plain.
Am I missing something?
Comment on Re: Reading a File Uploaded to a cgi script
I really couldn't tell you one way or the other. I pulled most of those statements directly from CGI.pm docs, made some modifications so they matched my variables and ran with it. Thanks for the input though.