CGI-Application-Plugin-AJAXUpload

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        ignores the filename, generates a safe one and does other
        housekeeping.
        *mime_type* This is the file extension passed by the browser.
        *data_size* By default this is required to be less than 512K.

        Note that this module's handling of file upload and data validation
        is somewhat different from that expected by
        Data::FormValidator::Constraints::Upload and
        Data::FormValidator::Filters::Image. Those modules work with file
        handles. The Data::FormValidator profiles required by this module
        are expected to work with the data and meta data.

    run_mode
        This is the name of the run mode that will handle this upload. It
        defaults to *ajax_upload_rm*.

  ajax_upload_default_profile
    This returns a hash reference to the default Data::FormValidator
    profile. It can be called as a class method.

  _ajax_upload_rm
    This private method forms the implementation of the run mode. It
    requires a *file* CGI query parameter that provides the file data.
    Optionally it also takes a *validate* parameter that will make other
    more paranoid checks. These checks are only optional because if the
    system is set up correctly they should never fail.

    It takes the following actions:

    --  It will get the filename and data associated with the upload and
        pass the data through the Data::FormValidator if a profile is
        supplied.

    --  If it fails the Data::FormValidator test a failed message will be
        passed back to the caller.

    --  If the *validate* parameter is set the setup will check. If there is
        a problem a status message will be passed back to the user.

    --  The data will then be copied to the given file, its path being the
        combination of the *httpdocs_dir* parameter, the *upload_subdir* and
        the generated file name.

    -   The successful JSON message will be passed back to the client.

DIAGNOSTICS
    Most error messages will be passed back to the client as a JSON message,
    though in a sanitised form. One error 'Internal Error' is fairly generic
    and so the underlying error message is written to standard error.

CONFIGURATION AND ENVIRONMENT
    CGI::Application::Plugin::AJAXUpload requires no configuration files or
    environment variables. However the client side code, the URL to run mode
    dispatching and the general web server setup is not supplied.

DEPENDENCIES
    This is using the "to_json" method from CGI::Application::Plugin::JSON.
    As such that module needs to be exported before this module. Or of
    course you could just define your own.

BUGS AND LIMITATIONS
    Please report any bugs or feature requests to
    "bug-cgi-application-plugin-ajaxupload@rt.cpan.org", or through the web
    interface at <http://rt.cpan.org>.

    One really odd thing is that the content header of the AJAX reply cannot
    be 'application/json' as one would expect. This module sets it to
    'text/javascript' which works. There is a very short discussion on the
    <YUI forum>.

AUTHOR
    Nicholas Bamber "<nicholas@periapt.co.uk>"

LICENCE AND COPYRIGHT
    Copyright (c) 2010, Nicholas Bamber "<nicholas@periapt.co.uk>". All
    rights reserved.

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

    The javascript code in the example draws heavily on the code provided by
    AllMyBrain.com.

DISCLAIMER OF WARRANTY
    BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
    FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
    OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
    PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
    ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
    YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
    NECESSARY SERVICING, REPAIR, OR CORRECTION.

    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
    WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
    REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
    TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
    CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
    SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
    RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
    FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
    SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    DAMAGES.



( run in 3.128 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )