I am using valums fileuploader in asp.net web application. It's working fine with the actual uploads as such. But the error condition checking is not working properly in Chrome and FF. The uploader points to a handler called fileupload.ashx which checks if a file with the same name already exists. The 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 expected above error message in result.error property. After some javascript debugging, I found that this code works well for IE8 but not in Chrome and FF. The xhr responseText contains null string when the transfer fails.
The javascript snippet from valums fileuploader.js is given below ...
xhr.onreadystatechange = function() { if (xhr.readyState == 4) { self._onComplete(id, xhr); } };
Surprisingly, responseText is properly returned even in Chrome and FF when the upload succeeds. Any help will be greatly appreciated.