| HTML-FormFu documentation | Contained in the HTML-FormFu distribution. |
HTML::FormFu::QueryType::CGI
As of HTML::FormFu version 0.02004, returns a HTTP::Headers object.
- Previously returned a hashref of values.
Returns the browser-submitted filename of the local file.
Returns a read-only filehandle.
Returns the contents of the uploaded file.
A shortcut for $upload->headers->content_length.
Returns the size of the uploaded file in bytes.
A shortcut for $upload->headers->content_type.
Returns the browser-submitted Content-Type of the uploaded file.
Is a sub-class of, and inherits methods from HTML::FormFu::Upload
Carl Franks, cfranks@cpan.org
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| HTML-FormFu documentation | Contained in the HTML-FormFu distribution. |
package HTML::FormFu::QueryType::CGI; use Moose; extends 'HTML::FormFu::Upload'; use HTTP::Headers; use Scalar::Util qw( blessed ); sub parse_uploads { my ( $class, $form, $name ) = @_; my $query = $form->query; my @params = $query->param($name); my @new; for my $param (@params) { if ( blessed $param ) { my $filename = $param; $param = $class->new( { _param => $param, filename => sprintf( "%s", $filename ), parent => $form, # TODO: for now, parent points to the form # pointing to a field will require handling multiple # fields of the same name # if fixed, other QueryTypes and MultiForm will need updating } ); my $headers = HTTP::Headers->new( %{ $query->uploadInfo($filename) } ); $param->headers($headers); $param->size( $headers->content_length ); $param->type( $headers->content_type ); } push @new, $param; } return if !@new; return @new == 1 ? $new[0] : \@new; } sub fh { my ($self) = @_; return $self->_param; } __PACKAGE__->meta->make_immutable; 1; __END__