NAME

Egg::Plugin::Upload - The file uploading is supported.

SYNOPSIS

 package [MYPROJECT];
 use strict;
 use Egg qw/-Debug Upload/;

 if ( my $upload= $e->request->upload('field_name') ) {
 
        my $filename= $upload->catfilename;
 
        # It copies it to an arbitrary place. 
        $upload->copy_to( "/path/to/save/$filename" );
 }

DESCRIPTION

Request driver behavior can be adjusted by setting TEMP_DIR, POST_MAX etc.

METHODS

upload and uploads are added as a method of Egg::Request.

my $upload= $e->request->upload([FIELD_NAME]);

The upload object specified by [FIELD_NAME] is returned.

Undefined returns if there is no specified upload.

 my $upload= $e->request->upload( 'upload_name' );

$upload->filename

The upload file name is returned.

$upload->tempname

Path where the file has been temporarily preserved is returned.

$upload->size

The size of the upload file is returned.

$upload->type

The contents type of the upload file is returned.

$upload->info

The HASH reference of various information concerning the up-loading file returns.

$upload->catfilename

$upload->filename seems to return in shape that local PATH of the client is included in case of mod_perl. Then, after only the file name is extracted, this method is returned.

$upload->copy_to

The file is temporarily copied to the specified place.

The hard link of files is temporarily made for the specified place.

SEE ALSO

Egg::Request::Apache, Egg::Request::CGI, Egg::Release,

AUTHOR

Masatoshi Mizuno <mizuno@bomcity.com>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Masatoshi Mizuno <mizuno@bomcity.com>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.