I am using valup fileuploader in asp.net web application. It works great with actual loading as such. But error checking does not work properly in Chrome and FF. The uploader user points to a handler named fileupload.ashx that checks to see if a file with the same name exists. C # code is given below ...
if (File.Exists (Path.Combine (path, fileName)))
{
returnJson = "{success: false, error: 'Duplicate filename'}";
context.Response.ContentType = "text / plain";
context.Response.Write (returnJson);
return
}
I was expecting the above error message in the result.error property. After some javascript debugging, I found that this code works well for IE8, but not in Chrome and FF. Xhr responseText contains an empty string when transmission fails.
Below is a javascript snippet from valums fileuploader.js ...
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
self._onComplete (id, xhr);
}
};
Surprisingly, responseText returns correctly even in Chrome and FF when the download completes successfully. Any help would be greatly appreciated.
source share