View Full Version : UpdateManager Abort not working when uploading files
bahar
28 Apr 2007, 2:07 AM
I'm using UpdateManager formUpdate method to upload some files. It works fine but when I wanted to add a cancel button that user can cancel uploads, I assumed calling the Abort method of the UpdateManager will do the trick, but it does nothing!
for make the cancel work I had to manually select the iframe that is used for upload process and Stop it.
I don't know if this is the best way to cancel the uploads but I think the Abort method should cancel the upload process.
Animal
28 Apr 2007, 2:21 AM
formUpdate does a form submission, not an XHR. It's a native browser operation, and can't be aborted programatically.
bahar
28 Apr 2007, 3:20 AM
That's right but Abort method should be kinda smart to check if the form has the attribute enctype="multipart/form-data" then stops the form submission in the automatically created iframe.
Animal
28 Apr 2007, 3:36 AM
How?
bahar
28 Apr 2007, 4:25 AM
Here's what I'm doing to stop the form submission:
Ext.Element.select('iframe').each(function(elm) {
mainWindow = elm.dom.contentWindow;
if (mainWindow && mainWindow.stop)
mainWindow.stop();
else if (mainWindow && mainWindow.document && mainWindow.document.execCommand)
mainWindow.document.execCommand('Stop');
});
Ext.Element.select('iframe').each(function(elem){ elem.remove(); });
Animal
28 Apr 2007, 5:59 AM
Yep, that will ensure the onready callback doesn't get fired.
In fact, the problem lies with YUI. The abort function does not delete the iframe.
If I were you, I'd log a bug request at the YUI sourceforge page. They could eaily add that. The id of the iframe is "yuiIO" + the transaction id, so they could drop the iframe in the abort call.
I'd go to sourceforge and second that request - it's a good idea.
bahar
28 Apr 2007, 10:25 AM
It seems that you sent the request to the SourceForge. Thanks
Animal
28 Apr 2007, 10:35 AM
Yeah, I thought they should support it. After you mentioned it, I saw that the YAHOO.util.Connect API doesn't support its own operations consistently for both submission methods.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.