despawnerer / jquery.instantupload

jQuery Instant Upload plugin
GNU General Public License v3.0
1 stars 0 forks source link

jQuery Instant Upload plugin

This fairly simple instant upload plugin turns any DOM element into a button that uploads a user-chosen file to the server through the forms mechanism, in a fashion somewhat similar to sending an ajax request.

Usage

$(element).upload({
    url: '',
    name: '',
    enctype: 'multipart/form-data',
    select: function(filename, id) { },
    submit: function(id) {},
    error: function(error, id) {},
    success: function(response, id) {},
    complete: function(id) {}
});

Most options should be pretty self-explanatory, but here goes:

All of the parameters are optional. All of the user-defined callbacks include the current uploader id as the last arg. Whenever a request is sent, the id changes, which allows one to use oen uploader to upload multiple files.