Skip to main content

file upload using dojo.io.frame.send doesn't work in IE the first time



I'm trying to do an ajax file upload using dojo.io.frame.send(). It works with FF and chrome without any issues but not in IE 8 (not sure about other versions). The code is pasted below:







function submitForm()

{

dojo.require("dojo.io.iframe");

dojo.io.iframe.send({

url : "/uploadfile.do",

form : "myForm",

method: "POST",

handleAs: 'text',

load : function(response, ioArgs)

{

return response;

},

error : function(response, ioArgs) {

return response;

}

});

return false;

}







I searched on the web and found this:


http://groups.google.com/group/dojo-interest/browse_thread/thread/17dace02652bcec3





which prompted me to add the following snippet after dojo.require() line in the above code:







if ((dojo.isSafari || dojo.isIE) && dojo.io.iframe["_frame"])

{

dojo.destroy(dojo.io.iframe['_frame']);

var frameName = dojo.io.iframe._iframeName;

dojo.io.iframe["_frame"] = window[frameName] = null;

if (window.frames)

window.frames[frameName] = null;

}







With this it doesn't work in IE the first time but works when I click on the upload button the second time.





Additional info: My form tag in HTML has method="post" parameter.


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?