Reporting error in case connection gets lost during upload with XHR uploader instead of assuming successful upload.

This commit reports network errors as errors by triggering an `Error` event when the browser supports to read the status code in such cases.

Issue #240 and #499 should be fixed by the change.