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.
No comments:
Post a Comment