admin 管理员组

文章数量: 1086019

I have a multiple file uploader but while it's uploading sometimes 1 out of 10 files doesn't make it and it returns a Failed to load resource: net::ERR_CONNECTION_RESET in chrome console. I tried to catch it with the try-catch, but it acts as if no error occurred. What am I doing wrong?

var ajax = new XMLHttpRequest();
ajax.open("POST", "/multiFileUploadHandler.php");
try {
    ajax.send(formdata);
} catch (err) {
    alert('Error: '+err);
}

I have a multiple file uploader but while it's uploading sometimes 1 out of 10 files doesn't make it and it returns a Failed to load resource: net::ERR_CONNECTION_RESET in chrome console. I tried to catch it with the try-catch, but it acts as if no error occurred. What am I doing wrong?

var ajax = new XMLHttpRequest();
ajax.open("POST", "/multiFileUploadHandler.php");
try {
    ajax.send(formdata);
} catch (err) {
    alert('Error: '+err);
}
Share Improve this question asked Mar 5, 2014 at 10:35 Matthew AbrmanMatthew Abrman 73110 silver badges18 bronze badges 1
  • usually this error happens when the server's transport detected a error condition and thus it does reset your TCP/IP connection ! :) – Mehdi Maghrouni Commented Mar 26, 2014 at 16:43
Add a ment  | 

1 Answer 1

Reset to default 6

This is likely because it is async. Try catching this with an onerror event handler.

ajax.onerror = function(error) {
    // handle error
};

edit: corrected syntax.

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)