| 1 | |||
| 2 | ########################################################################### | ||
| 3 | # Copyright (c) Nate Wiger http://nateware.com. All Rights Reserved. | ||
| 4 | # Please visit http://formbuilder.org for tutorials, support, and examples. | ||
| 5 | ########################################################################### | ||
| 6 | |||
| 7 | # file fields are rendered exactly like text fields | ||
| 8 | |||
| 9 | package CGI::FormBuilder::Field::file; | ||
| 10 | |||
| 11 | use strict; | ||
| 12 | use warnings; | ||
| 13 | no warnings 'uninitialized'; | ||
| 14 | |||
| 15 | use CGI::FormBuilder::Util; | ||
| 16 | use CGI::FormBuilder::Field::text; | ||
| 17 | use base 'CGI::FormBuilder::Field::text'; | ||
| 18 | |||
| 19 | |||
| 20 | our $VERSION = '3.10'; | ||
| 21 | |||
| 22 | *render = \&tag; | ||
| 23 | sub tag { | ||
| 24 | my $self = shift; | ||
| 25 | # special catch to make life easier (too action-at-a-distance?) | ||
| 26 | # if there's a 'file' field, set the form enctype if they forgot | ||
| 27 | if ($self->{_form}->smartness) { | ||
| 28 | $self->{_form}{enctype} ||= 'multipart/form-data'; | ||
| 29 | debug 2, "verified enctype => 'multipart/form-data' for 'file' field"; | ||
| 30 | } | ||
| 31 | return $self->SUPER::tag(@_); | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | __END__ |