HTML::...Upload(3pm)
πΈ NAME πΈ
okay bestie, meet HTML::FormHandler::Field::Upload β itβs the file upload field, and this whole page is HTML::...Upload(3pm) from the User Contributed Perl Documentation corner. π
β¨ VERSION β¨
version 0.40068 β thatβs the version, no cap. β¨
π DESCRIPTION π
This field is designed to be used with a blessed object with a 'size' method β think Catalyst::Request::Upload β or a filehandle. It validates that the file is not empty and is within the 'min_size' and 'max_size' limits. Those limits are in bytes, bestie. π₯
π¨ important vibe check: a form containing this field must have the enctype set. Periodt.
Hereβs the example setup, exactly:
package My::Form::Upload;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
has '+enctype' => ( default => 'multipart/form-data');
has_field 'file' => ( type => 'Upload', max_size => '2000000' );
has_field 'submit' => ( type => 'Submit', value => 'Upload' );
Then 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 );
Also β and this is lowkey useful β you can set the min_size and max_size limits to undef if you donβt want them to be validated. π«Ά
π¦ DEPENDENCIES π¦
π§ widget π§
Widget type is 'upload'. Thatβs the dependency tea. π
π AUTHOR π
FormHandler Contributors - see HTML::FormHandler. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Gerda Shank.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay, thatβs the manual page, bestie π β signing off from perl v5.34.0, dated 2022-03-25, with HTML::...Upload(3pm) energy. mwah πβ¨
π¦ where this page comes from
- debian bookworm: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms