View Full Version : How to handle connection reset in file upload?

16 Apr 2013, 11:06 AM
Hi, I am trying to upload a file using Ext.form.Panel. On click on import button in import panel my code is like this:

if (form.isValid()) {
hasUpload: true,
waitMsg: 'some message',
success: function (file, action) {
//msg },
failure: function (file, action) {
//msg }

This code is working fine and I am able to upload file successfully. But the problem which I am facing is during the time of upload, if I loose connection or bring down the server, I keep seeing progress bar with waitMsg. There is no way to stop it unless I refresh the page. I tried to use 'timeout' in the form but the form is not timing out in this case. Let me know what is the best way to handle such case.

18 Apr 2013, 9:43 AM
Try setting a timeout that hides the MessageBox with x seconds (in the event your server simply doesn't respond).

From the example at:

//This simulates a long-running operation like a database save or XHR call.
//In real code, this would be in a callback function.
Ext.example.msg('Done', 'Your fake data was saved!');
}, 8000);