NAME

Egg::Request::Upload - Base class for file upload.

SYNOPSIS

use Egg qw/ Request::Upload /;

# Acquisition of up-loading object.
my $upload= $e->request->upload('upload_param_name');

DESCRIPTION

This is a base class for the file upload.

The plugin to use this module is prepared.

Please load Egg::Plugin::Request::Upload to use it.

Whether the plugin is used in the mod_perl environment is distinguished and the best following subclasses are read.

Egg::Request::Upload::ModPerl, Egg::Request::Upload::CGI,

Please set environment variable 'POST_MAX' to the high limit setting of the size of the upload file.

Please set environment variable 'TEMP_DIR' temporarily to set passing the work file.

Please refer to the document of mod_perl and CGI.pm for details for the environment variable.

METHODS

new ([REQUEST_CONTEXT], [PARAM_NAME])

Constructor.

The Egg::Request object is received with REQUEST_CONTEXT.

When $e->request->upload is called, this method is internally called.

When any REQUEST_CONTEXT->r->upload(PARAM_NAME) doesn't return it, undefined is returned.

my $upload= $e->request->upload( ...... ) || die 'There is no upload file.';

handle

The file steering wheel to the preservation place of the up-loading file is temporarily returned.

my $value= join '', $upload->handle->getlines;
  • Alias = fh

catfilename

Only the file name that doesn't contain the directory path of the upload file is returned.

my $filename= $upload->catfilename;

copy_to ([COPY_PATH])

The upload file of the work place is temporarily copied to COPY_PATH.

$upload->copy_to("/path/to/upload/$filename");

The hard link of the upload file of the work place is temporarily made in LINK_PATH.

$upload->link_to("/path/to/upload/$filename");

SEE ALSO

Egg::Release, Egg::Request, Egg::Request::Upload, Egg::Request::Upload::CGI, Egg::Request::Upload::ModPerl, Egg::Plugin::Request::Upload, Class::Accessor::Fast,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

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.