callback on upload complete

Im new to swfupload.
I need to call a particular function when the uplaod has completed.
The function updates an image to the one that was just uploaded.
But this need a variable passed, and Im not sure how to do that...

something like:
upload_success_handler : uploadSuccess(cat),
where cat is the variable being passed.

and then in handlers.js:

function uploadSuccess(file, serverData, cat_id) {
try {
this.myFunction(cat_id);

} catch (ex) {
this.debug(ex);
}
}

But I think its getting the passed variable, cat_id, confused with the file and serverdata parameters.

Any help greatly appreciated

gyphie's picture

Where does it come from

Where does the value for cat_id come from? If cat_id is just a static value then I'd either use a global variable or a closure:

upload_success_handler: function (file, serverData) { uploadSuccess(file, serverData, cat); }

If cat_id is coming from the server then you use serverData to retrieve the returned value and do whatever parsing you need.