
IWL::SWFUpload - a file upload widget using the flash swfupload library

IWL::Error -> IWL::Object -> IWL::Widget -> IWL::Container -> IWL::SWFUpload

The SWFUpload widget is a widget for upload files. It uses the flash swfupload library in order to achieve true multi-upload functionality. Visually, it's equivalent to a form's [Browse ...] button.

IWL::SWFUpload->new ([%ARGS])
Where %ARGS is an optional hash parameter with with key-values.
If true, the invoked file selector can pick multiple files. Defaults to false
If true, file uploading starts as soon as the files are selected. An upload/stop button is never placed on the page.

The object has the following public properties
A browse button, of class IWL::Button. When pressed, it invokes the browser file selector.
An upload button, of class IWL::Button. Before the upload button starts, it's action is to start it.
A stop upload button, of class IWL::Button. After the upload start, this button can abort the process.

Fires when the widget is loaded.
Fires immediately before the file selector is displayed. Due to the blocking nature of the file selector, the callback might not be executed until the selector is closed.
Fires when a file is queued. Receives the file object as a second parameter
Fires when an error has occurred while queueing a file. It received the file object, error code and error message as parameters, starting from the second parameters
Fires when the file selector is closed, and all the selected files have been processed. It received the number of selected files as a second parameter.
Fires just before the file is uploaded. It receives the file object as a second parameter.
Fires periodically to indicate the upload process. It received the file object, the uploaded bytes, and the total byte count as parameters, starting from the second parameter. A bug in the Linux Flash Player might prevent this signal from firing more than once.
Fires when an upload does not complete successfully, or by stopping/cancelling the upload. It receives the file object, error code and error message as parameters, starting from the second parameter.
Fires when the upload has been completed successfully. Receives the file object and any data returned from the server as parameters, starting from the second parameter.
Fires at the end of the upload cycle. When fired, the upload will be fully completed, so that another may start. Receives the file object as a second parameter.

Sets whether the widget's file selector can pick multiple files
Parameters: BOOL - if true, the selector can pick multiple files.
Returns true if the file selector can pick multiple files
Sets the upload script to call
Parameters: URL - the url to call on file upload
Returns the url of the upload script
Sets additional post parameters to pass to the script
Parameters: %PARAMS - a hash of parameters
Returns the post parameters
Sets the allowed file types for upload.
Parameters: TYPES - the allowed types. A semicolor separater string of glob patterns. See glob(3). DESCRIPTION - a description, which is displayed in the file selector
Returns the allowed file types and the description.
Sets the maximum size of the files to be uploaded.
Parameters: LIMIT - the size limit, in KB, unless a unit is specified. Examples: 147483648 B, 2097152, 2097152KB, 2048 MB, 2 GB
Returns the maximum size of the files to be uploaded
Sets the maximum number of files that can be uploaded
Parameters: LIMIT - the number of files to be uploaded, or 0 for unlimited uploading.
Returns the maximum files that can be uploaded
Sets the maximum number of files that can be queued
Parameters: LIMIT - the limit number. 0 for an unlimited queue
Returns the maximum number of files that can be queued
Registers an SWFUpload plugin. The following plugins are currently available, and documented within their respective JavaScript files:
If this plugin is registered, it will automatically add the cookie string to a POST parameter, named SWFUploadCookie.
Parameters: PLUGIN - the name (or a list of names) of the plugin to register.

Viktor Kojouharov


Copyright (c) 2006-2007 Viktor Kojouharov. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perldoc perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.