k2OS has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I am trying to pass a unique db-id from a hidden field in my form to the upload_hook-sub in my file upload-script (to use sanitized filenames), but seem to have run into something that was only half-baked.
According to the manual page for CGI, $data can be used to pass extra data to the upload_hook (ie. a database ID), _but_ according to the manual (and the tests I've done) I cannot perform the necessary param()-call on the submitted data to actually get the DB-id needed before declaring my CGI-object ($q = CGI->new(\&hook, $data) - a true hen&egg-situation as I see it.
I've searched the site over and over and over again, but couldn't find one single example code that actually uses $data for anything. I did fine one that uses CGI and CGI::Ajax to make an upload progress bar, but it uses tainted filenames to track the status of the upload, which, I believe, is stronly discouraged.
I have been poking at CGI.pm to see if I might be able to pass my unique ID to the hook in some other way (along with $filename and $bytes_read that already is passed by default), and I did manage to find the spot where data is passed to the hook, but my perl-foo ends there, unfortunately.
Can anyone provide working example of using upload_hooks with $data, or should I post a bug-report, asking the CGI-developers to kindly re-iterate the implementation for the upload_hook?
I thank thee kindly in advance for any reply
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing database ID to \&hook through $data (CGI)
by stonecolddevin (Parson) on Sep 20, 2008 at 06:42 UTC | |
|
Re: Passing database ID to \&hook through $data (CGI)
by Anonymous Monk on Sep 20, 2008 at 07:21 UTC | |
by k2OS (Initiate) on Sep 20, 2008 at 10:05 UTC | |
by Anonymous Monk on Sep 20, 2008 at 11:30 UTC | |
by k2OS (Initiate) on Sep 20, 2008 at 15:05 UTC | |
by Anonymous Monk on Sep 20, 2008 at 16:09 UTC | |
|