Subject: | upload() does not return open handle (prematurely closed?) |
Hello,
I've a script that has 2 upload functions:
• one uploads from the file handle to disk.
• The other attaches the tmp file to an email.
The latter works fine. The former stopped working today (no code changes).
Before and after the upload() call the object dump is the same (only the
tmpfile path is different).
Here is the original code:
[code]
my $cgi = CGI->new(); # no $CGI:: vars set so they are the defaults
...
my $tmp_fh = $cgi->upload($param_name);
if ( defined $tmp_fh ) {
...
[/code]
I had to add this after the call to upload() to get it to work:
[code]
# rt
my $upload_hack = '';
if (!defined $tmp_fh) {
my $filename = $$cgi->param($param_name);
if ($filename) {
$upload_hack = $cgi->tmpFileName($filename);
open $tmp_fh, '<', $upload_hack; # unlink()d when we're done
w/ it
}
}
[/code]
Any ideas why it'd be closed?
Is there a better way to detect this and reopen?
thanks!
--
Dan