in reply to Yet Another CGI File Upload Question
To be safe, use the upload() function (new in version 2.47). When called with the name of an upload field, upload() returns a filehandle, or undef if the parameter is not a valid filehandle.This is the recommended idiom.$fh = $query->upload('uploaded_file'); while (<$fh>) { print; }
Of course, you still need to get your CGI object into do_stuff, but that's easy---pass it as a parameter. In fact, you're already doing that (using \$q is unnecessary---$q is already a reference), so just using the passed parameter in your sub should solve this.
|
|---|