On Sun, Jan 24, 2010 at 7:03 AM, Octavian Rasnita <[email protected]>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
[email protected]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/