Well, I figured out a way to trigger custom event for this requirement. Posting the answer here in case if anyone is wondering how to achieve the same.
The core file which we need to change should be located at "js\jquery.fileupload-ui.js"
inside the add call back add: function (e, data) {
the last listener is }).fail(function () {
. This should be at approximately line number 120 (depending on the version)
In that we need to add the following line :
that._trigger('addfileerror', e, data);
To summarize your fail listener should look like below:
}).fail(function () {
if (data.files.error) {
data.context.each(function (index) {
var error = data.files[index].error;
if (error) {
$(this).find('.error').text(error);
}
});
// added custom event to check whether any error has occured while adding the file.
that._trigger('addfileerror', e, data);
}
})
Now we can bind a listener just like any other listener to check for this event.
$('#fileupload').bind('fileuploadaddfileerror', function (e, data){
console.log('Custom Error Event Fired');
});
Hope this helps someone.
UPDATE:
Even though the document doesn't mention it clearly, I have just learnt that "fileuploadprocessfail" event does exactly the same for the above requirement.