[2.x] response empty with file upload Ext.Ajax.request
I'm using Ext.Ajax.request to submit a file upload form to work with the Scribd API to upload a document.
The upload works fine, but the response object is returning empty:
Code:
{
argument: undefined,
responseText: "",
responseXML: undefined
}
Using both Firebug and Safari's developer console, I think the problem is that for some reason the "document" in the iframe used to submit the form is undefined.
When I remove the "x-hidden" class from the iframe, Scribd's return XML is there:
Code:
<rsp stat="ok">
<doc_id>123456</doc_id>
<access_key>key-rvfa2c82sq5bf9q8t6v</access_key>
<secret_password>2jzwhplozu43cyqfky1m</secret_password>
</rsp>
and it's encoded:
Code:
<?xml version="1.0" encoding="UTF-8"?>
I can't figure out why Ext.Ajax.request can't read the XML in the callback function.
It's this function in Ext.data.Connection.doFormUpload that's causing the problem:
Code:
function cb(){
var r = { // bogus response object
responseText : '',
responseXML : null
};
r.argument = o ? o.argument : null;
try { //
var doc;
if(Ext.isIE){
doc = frame.contentWindow.document;
}else {
doc = (frame.contentDocument || window.frames[id].document);
}
if(doc && doc.body){
r.responseText = doc.body.innerHTML;
}
if(doc && doc.XMLDocument){
r.responseXML = doc.XMLDocument;
}else {
r.responseXML = doc;
}
}
catch(e) {
// ignore
}
Ext.EventManager.removeListener(frame, 'load', cb, this);
this.fireEvent("requestcomplete", this, r, o);
Ext.callback(o.success, o.scope, [r, o]);
Ext.callback(o.callback, o.scope, [o, true, r]);
setTimeout(function(){Ext.removeNode(frame);}, 100);
}
Thoughts?