|Problems? Is your data what you think it is?|
CGI.pm's upload hook with tempfile offby friedo (Prior)
|on Nov 10, 2006 at 02:29 UTC||Need Help??|
friedo has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use CGI's upload hook feature to keep track of the progress of large file uploads. According to the docs,
The $use_tempfile field is a flag that lets you turn on and off CGI.pm's use of a temporary disk-based file during file upload. If you set this to a FALSE value (default true) then param('uploaded_file') will no longer work, and the only way to get at the uploaded data is via the hook you provide.
I want to turn off temp files and handle the data myself. Unfortunately, when I set this value to 0, my hook does not seem to ever get called.
Here's some code which works:
This code works fine and my hook gets called, but it creates a temporary file which I don't want.
When I change the constructor to this,
...the hook does not get called. (At least, there's no evidence of it in the error log.)
Thanks for any help.
Update: It also appears to fail if I explicitly set the third parameter to 1. Apparently it only works with the third parameter unspecified, but I don't want the default behavior. :(