| OpenPlugin documentation | Contained in the OpenPlugin distribution. |
OpenPlugin::Upload - Handle file uploads
my $OP = OpenPlugin->new(); my @uploads = $OP->upload->get_incoming() my $upload = $OP->upload->get_incoming( $name );
get_incoming( [ $name ] )
get( [ $name ] )
With no arguments, this returns a list of filenames mapping to the files
uploaded by the client. If you pass in $name then you get a hashref
containing the keys:
The name given in the upload field.
The content-type of the file.
The size of the file.
The file handle of the file.
The real name of the file being uploaded.
set_incoming( \%upload )
Associates the OpenPlugin::Upload %upload hash with $upload-{ name }>.
See get_incoming for a list of valid parameters this function accepts.
See the TO DO section of the <OpenPlugin::Request> plugin.
None known.
See the individual driver documentation for settings and parameters specific to that driver.
Copyright (c) 2001-2003 Eric Andreychek. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Eric Andreychek <eric@openthought.net>
| OpenPlugin documentation | Contained in the OpenPlugin distribution. |
package OpenPlugin::Upload; # $Id: Upload.pm,v 1.13 2003/04/03 01:51:24 andreychek Exp $ use strict; use base qw( OpenPlugin::Plugin ); use Data::Dumper qw( Dumper ); $OpenPlugin::Upload::VERSION = sprintf("%d.%02d", q$Revision: 1.13 $ =~ /(\d+)\.(\d+)/); sub OP { return $_[0]->{_m}{OP} } sub type { return 'upload' } *get = \*get_incoming; sub get_incoming { my ( $self, $name ) = @_; unless ( $name ) { return ( ref $self->state->{upload} eq 'HASH' ) ? keys %{ $self->state->{upload} } : (); } if ( ref $self->state->{upload}{ $name } eq 'ARRAY' and wantarray ) { return @{ $self->state->{upload}{ $name } }; } return $self->state->{upload}{ $name }; } sub set_incoming { my ( $self, $upload ) = @_; return undef unless ( $upload->{ name } ); return $self->state->{ upload }{ $upload->{ name } } = $upload; } 1; __END__