I’m trying to get the error handling to work for chunked file upload using blueimps jquery fileupload.
I have the following code, in which when a server side error occures, the error method never gets hit:
$('#fileupload').fileupload({
dataType: 'json',
maxFileSize: 50 * 1000 * 1000 * 1000,
maxChunkSize: 5 * 1024 * 1024,
singleFileUploads: true,
sequentialUploads: true,
add: function (e, data) {
var jqXHR = data.submit()
.success(function (result, textStatus, jqXHR) {
debugger;
var url = "/Upload.ashx?SetId=@Model.SetId&filename=" + result[0].name + "&ct=" + result[0].type + "&multiUpload=complete";
url = encodeURI(url);
$.ajax(url);
})
.error(function (jqXHR, textStatus, errorThrown) {
alert(textStatus);
})
.complete(function (result, textStatus, jqXHR) {
//alert("complete");
});
}
});
Neither when I return json like {“error”,”Error with the extension of the file”} with an Http 200 response, nor a http 500, make the code hit the above error method.
I think you have to handle jQuery ajax method error.