HTML::FormHandler::Field::Upload - File upload field
This field is designed to be used with Catalyst::Request::Upload. Validates that the input is an uploaded file. A form containing this field must have the enctype set.
package My::Form::Upload; use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; has '+enctype' => ( default => 'multipart/form-data'); has_field 'file' => ( type => 'Upload' ); has_field 'submit' => ( type => 'Submit', value => 'Upload' );
In your controller:
my $form = My::Form::Upload->new; my @params = ( file => $c->req->upload('file') ) if $c->req->method eq 'POST'; $form->process( params => { @params } ); return unless ( $form->validated );
Widget type is 'upload'
Bernhard Graf & Oleg Kostyuk
and FormHandler contributors
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::FormHandler, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::FormHandler
CPAN shell
perl -MCPAN -e shell install HTML::FormHandler
For more information on module installation, please visit the detailed CPAN module installation guide.