[Catalyst] Where is the form field lost?
Bill Moseley
moseley at hank.org
Sun Jan 24 15:39:49 GMT 2010
On Sun, Jan 24, 2010 at 7:03 AM, Octavian Rasnita <orasnita at gmail.com>wrote:
I need to know if the form didn't have a file upload field, or if it had it
but no file was uploaded.
Give your upload field(s) a name like "upload_1" and then see if it exists
in uploads.
Can you give me a hint where I should look for finding where the empty file
> upload field is skipped if it is empty?
>
That's how HTTP::Body works. If there's a filename, which there is with
upload fields, but the file name is empty, then it's skipped.
if ( exists $part->{filename} ) {
if ( $part->{filename} ne "" ) {
$part->{fh}->close if defined $part->{fh};
delete @{$part}{qw[ data done fh ]};
$self->upload( $part->{name}, $part );
}
}
BTW -- I think that delete of "fh" should not happen (and the temp file
should be set to unlink on destroy). Otherwise you can end up with orphaned
temp files.
-- =
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100124/decf2=
0bd/attachment.htm
More information about the Catalyst
mailing list