Version 1.1 * Removed the jQuery UI header as requested
Version 1.0 * A uploadComplete callback now receive a array of the data returned of each file uploaded * Documentation about File Groups
Version 0.9 * Complete documentation * License * renamed all the references to jQuery-ui-upload * Warning message pass as options * Theme roller link at demo page
Version 0.8 * Update documentation * Internet Explorer issues (Queue Handler)
Version 0.7 * Smart filesize convertion * Handler overall progress per file * Long filesize splitted
Version 0.6 * Callback for overall progress * Integration with block UI at demo page
Version 0.5 * jQuery UI Theming of delete button and warnings * file size limit
Version 0.4 * Callback for all files completed * Fixed delete handlers bug
Version 0.3 * Callbacks for file upload success and file upload complete * Additional post parameters throught postParams
Version 0.2 * handler the file delete from queue
This plugin is a multiple file upload jQuery-UI plugin.
This plugin it's a swfupload abstraction layer developed with the pattern of jQuery UI.
- File progress
- Complete jQuery UI Interface
- Validation and handlers based in file groups
- SWFUpload
- jQuery UI
- Firefox 3+ Windows / MAC / Linux
- IE 6, 7+ Windows
- File progress don't work properly at Mac OS. Whatever, the plugin has their own implementation of overall progress that can be used.
This feature it's when this plugin differ from other uploads scripts. When you are dealing with images, documents and other types, generally they a group of formats. With this plugin you can make rules for each type and even create custom types with their own implementation. See the example below:
$(function(){
$("#vertical").upload({
url: '/upload/',
rules: {
'image' : {
'fileTypes' : ['jpeg', 'jpg', 'png'],
'limit' : 6,
'size' : '200 KB'
},
'video' : {
'fileTypes' : ['mov'],
'limit' : 1,
'size' : '20 MB'
}
},
});
});
- type: String
- default: '/upload/'
- description: The URL where the upload will be processed and the post file data and other parameters will be sent
- type: String
- default: 'libs/swfupload.swf'
- description: The path of the flash file used by plugin
- type: Object
- default: {}
- description: A object of additional post params that will be send to the server
- example:
$(function(){ $ ("#vertical").upload({ postParams: { 'key' : 'value', 'key2' : 'value2' }, }); });
- type: String
- default: btn-upload-select.png
- description: The path of the image used to button that open the file dialog. This image should be a sprite of three images one bellow each other with the normal state, hover state and active state
- type: String
- default: Select File(s)
- description: the text that appear at button that activate the file dialog. You can use html tags to use stylesheets at style option described bellow
- type: Number
- default: 178
- description: the width of the button in pixels
- type: Number
- default: 30
- description: the height of the button in pixels
- type: Number
- default: 5
- description: the button top padding in pixels used for alignment purposes
- type: String
- default: .text {color: black; font-weight: bold; font-size: 16pt; text-align:center;margin-top:15px;}
- description: used to apply stylesheets declared at buttonText
- type: Boolean
- default: true
- description: Specify if the upload will be multiple or not, letting the user hold control to select more than one file at file dialog
- type: Object
- default: see example
- description: To make easier and flexible the management of file types, this object you can create group of file types that hold the rules of limit, formats and size of the files
- example:
$(function(){ $ ("#vertical").upload({ rules: { 'image' : { 'fileTypes' : ['jpeg', 'jpg', 'png'], 'limit' : 6, 'size' : '200 KB' }, 'video' : { 'fileTypes' : ['mov'], 'limit' : 1, 'size' : '20 MB' } }, }); });
- type: String
- default: choose file(s)
- description: the message that appear at file choose dialog
- type: String
- default: The limit of {limit} was reached
- description: the message of warning when the file reach the limit. You can use {limit} to reference this limit that is declared at limit in option rules
- type: Boolean
- default: false
- description: create a log at browser to debug all the events and status of the file upload cycle
- type: Function
- description: Callback that is called where the flash movie is correctly loaded
- type: Function
- description: Callback fired when the choose file dialog is open
- type: Function
- parameters: file
- description: Callback fired when a file is choosed and is valid, making a queue of files. The file Object has information about name, size etc
- type: Function
- parameters: file, error, msg
- description: Callback fired when a file for some reason doesn't enter in queue
- type: Function
- parameters: selected, queued, total
- description: Callback to track the files selected, the files queued and the total of files in queue
- type: Function
- parameters: file
- description: Callback fired when each upload started
- type: Function
- parameters: file, bytes, total
- description: Callback fired when the current file is uploading, giving the bytes already uploaded and the total
- type: Function
- parameters: percent, currentFile
- description: Callback fired of the overall progress, very useful for progress
- type: Function
- parameters: file
- description: Callback fired when each upload was successfully completed
- type: Function
- parameters: fileData
- description: Callback fired when all uploads are completed, you have access a array of data returned throught fileData. The plugin assumes that the return it's a JSON Object.
- description: This method start the upload process and can be used in any event,
- example:
$(function(){ uploadInstance = $ ('#upload').upload(); uploadInstance.upload('startUpload'); });
- parameters: number
- description: Convert the file size in bytes to the most smart filesize. If you passa uni like '20 KB' they convert to bytes
- description: return all the files in the queue
- description: return the swfupload instance and you can use his methods
- parameter: id
- description: return the file object based in his id