Alexandre Masselot > CGI-FileUpload > CGI::FileUpload

Download:
CGI-FileUpload-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

CGI::FileUpload - A module to upload file through CGI asynchrnously, know where the upload status and get back the file from a third parties on the server

VERSION ^

DESCRIPTION ^

An uploaded file is associated with a key (corresponding to a file in a server temp directory)

When uploading is started the key is returned before the uploading completed, allowing further queries such as knowing is the upload is completed, uploaded file size etc...

SYNOPSIS ^

    use CGI::FileUpload;

    my $fupload = CGI::FileUpload->new();
    ...

EXPORT ^

FUNCTIONS ^

uploadDirectory()

Returns the session upload directory (by default is $CGI_FILEUPLOAD_DIR or /defaulttempdir/CGI-FileUpload)

formString([parameter=>val]);

Returns a html <FORM> string such as <form name='cgi_fileupload' method='post' enctype='multipart/form-data'> <input type='file' name='uploadfile'/> <input type='hidden' name='action' value='upload'/> <input type='hidden' name='return_format' value='text'/> <input type='submit' value='upload'> </form>

Parameters can be of

submit_value=>string: the value displayed on the "submit button"
return_format=>(keyonly|text|json): the type of output at submission time (default is keyonly, but a text key=value perl line, but json should also be possible)
form_name=>string the form name (default is 'cgi_fileupload'

idcookie(query=>$cgi_query)

Either retrieves the id cookie or build one based one random number + ip

METHODS ^

Constructors

my $fupload=new CGI::FileUpload();

Creates a new instance in the temp directory

my $fupload=new CGI::FileUpload(suffix=>string);

Creates a file (thus returns a key)ending with .string

my $fupload=new CGI::FileUpload(key=>string);

Read info for an existing file being (or having been) uploaded.

Getting(/setting mor internal) info

$fupload->key()

returns the reference key

$fupload->from_ipaddr()

Returns the originated IP address

$fupload->from_id()

Returns some user id (hidden in a randomized cookie)

$fupload->upload_status()

Returns a string '(uploading|completed|killed)'

$fupload->properties

Returns a Util::Properties object associated (containing status and whatever info

$fupload->file()

Returns the local file associated with the uploaded file

Actions

$fupload->upload() (query=>$cgi_query [,opts])

Start the upload. A CGI::query must be passed. Other optional arguments can be of

asynchronous=>(1|0) to see if the transfer must be completed before returning (0 value). default is 1;

$fupload->remove()

Removes the file upload structure from the temp directory

$fupload->kill([signal=>value])

Kill the uploading process (default signal is 'INT')

AUTHOR ^

Alexandre Masselot, <alexandre.masselot at genebio.com>

BUGS ^

Please report any bugs or feature requests to bug-cgi-fileupload at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-FileUpload. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc CGI::FileUpload

You can also look for information at:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2007 Alexandre Masselot, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: