Reputation: 6438
There is a great multiple-file upload script out there, totally flash free:
http://valums.com/ajax-upload/
Now, while it works for me, I'd like some code to be executed when the upload is done. I think the script provides this functionality, in examples it has this:
onComplete: function(id, fileName, responseJSON){}
but I'm not sure how I'd use it - I just need to have some code executed after the upload is successfully finished.
Sorry if it's a script-specific question, looked to me like it may be general js knowledge.
Upvotes: 0
Views: 165
Reputation: 70819
The {}
denotes the function body. Here it is expanded:
onComplete: function(id, fileName, responseJSON){
//this is where you do something on completion.
//you have access to the id, the filename and the JSON.
}
So, for example:
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
action: '/server-side.upload',
// additional data to send, name-value pairs
params: {
param1: 'value1',
param2: 'value2'
},
onComplete: function (id, fileName, responseJSON) {
alert(fileName + ' was successfully uploaded');
}
});
When it has completed, uploader will execute the onComplete
function, passing in the id, filename and JSON.
Upvotes: 2