1HTML::FormHandler::FielUds:e:rUpCloonatdr(i3b)uted PerlHDToMcLu:m:eFnotramtHiaonndler::Field::Upload(3)
2
3
4
6 HTML::FormHandler::Field::Upload - file upload field
7
9 version 0.40068
10
12 This field is designed to be used with a blessed object with a 'size'
13 method, such as Catalyst::Request::Upload, or a filehandle. Validates
14 that the file is not empty and is within the 'min_size' and 'max_size'
15 limits (limits are in bytes). A form containing this field must have
16 the enctype set.
17
18 package My::Form::Upload;
19 use HTML::FormHandler::Moose;
20 extends 'HTML::FormHandler';
21
22 has '+enctype' => ( default => 'multipart/form-data');
23
24 has_field 'file' => ( type => 'Upload', max_size => '2000000' );
25 has_field 'submit' => ( type => 'Submit', value => 'Upload' );
26
27 In your controller:
28
29 my $form = My::Form::Upload->new;
30 my @params = ( file => $c->req->upload('file') )
31 if $c->req->method eq 'POST';
32 $form->process( params => { @params } );
33 return unless ( $form->validated );
34
35 You can set the min_size and max_size limits to undef if you don't want
36 them to be validated.
37
39 widget
40 Widget type is 'upload'
41
43 FormHandler Contributors - see HTML::FormHandler
44
46 This software is copyright (c) 2017 by Gerda Shank.
47
48 This is free software; you can redistribute it and/or modify it under
49 the same terms as the Perl 5 programming language system itself.
50
51
52
53perl v5.36.0 2022-07-22HTML::FormHandler::Field::Upload(3)