Hybrid View

  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    176
    Vote Rating
    0
    zquirm is on a distinguished road

      0  

    Default [2.x] response empty with file upload Ext.Ajax.request

    [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?

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,520
    Vote Rating
    376
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Do you use standard Ext way to upload the file or you have your own routine? I'm asking, because Ext uses hidden iframe with form to upload files, Ajax cannot be used.

    You can also take a look at http://filetree.extjs.eu FileUploader class.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    176
    Vote Rating
    0
    zquirm is on a distinguished road

      0  

    Default


    I'm using Ext's way (Ext.Ajax.request with isUpload set to true). When I remove the "x-hidden" class from the iframe, the XML response is there, so the upload is happening, but the Ajax request response returns empty.

  4. #4
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,520
    Vote Rating
    376
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Do you return header "Content-Type: text/html; charset=utf8"? Is the body of response {"success":true}?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,188
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    zquirm -

    This is a bug in Ext 2.2.1 and has been fixed in SVN. Look for it to be resolved in the next release of Ext 2.x. (2.2.2).
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    176
    Vote Rating
    0
    zquirm is on a distinguished road

      0  

    Default


    Aaron, are there specific files I can copy from the SVN to make this work now? I tried copying the code from Ext.data.Connection to override what's currently there, and I'm still getting an empty response.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi