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

      0  

    Default


    Yeah...both doc and doc.body are undefined. I'm using an API I have no control over, so I can't control how the response comes in. The browser displays their XML response just fine, but because Ext is using "contentDocument" or "document", the response cannot be read...even though it's there.

  2. #22
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    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


    I really run out of ideas...
    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. #23
    Ext User
    Join Date
    Mar 2007
    Posts
    176
    Vote Rating
    0
    zquirm is on a distinguished road

      0  

    Default


    I do appreciate the help...it's baffling me as well.

  4. #24
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,163
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    I can agree that the responseXML isn't being returned properly, but Ext tries to grab the XML returned by the document.

    That being said, I can still grab the response content.

    HTML
    Code:
    <body>
            <form id="foo">
                <input type="file" />
            </form>
        </body>
    CODE
    Code:
    Ext.onReady(function(){
        var btn = new Ext.Button({
            text: 'Foo',
            renderTo: document.body,
            handler: function(){
                Ext.Ajax.request({
                    url: 'data.asp',
                    isUpload: true,
                    form: Ext.getDom('foo'),
                    success: function(r){
                        console.log(r);
                    }
                });     
            }
        });
    });
    DATA
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <rsp stat="ok">
      <doc_id>15345909</doc_id>
      <access_key>key-xxxxxxxxxxxxxxxxxxxxx</access_key>
    </rsp>
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

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

      0  

    Default


    This must be a problem with the contentType of the response (which is "application/xml"), b/c I'm still getting an empty response.

    I created a test Scribd account. Try running this, a variation of what you sent:

    HTML
    Code:
    <body>
            <form id="foo">
                <input type="file" name="file" />
            </form>
        </body>
    CODE
    Code:
    Ext.onReady(function(){
        var btn = new Ext.Button({
            text: 'Foo',
            renderTo: document.body,
            handler: function(){
                Ext.Ajax.request({
                    url: 'http://api.scribd.com/api?method=docs.upload&api_key=30m3pu0z4lhzsnz0mewfv',
                    isUpload: true,
                    form: Ext.getDom('foo'),
                    success: function(r){
                        console.log(r);
                    }
                });     
            }
        });
    });

  6. #26
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,163
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Whenever I try to post to that URL I get a 500 error.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

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

      0  

    Default


    Not sure about the 500 error. I've tried that exact code on several platforms and browsers at this point. The upload works, but I'm still getting this response:

    Code:
    argument: undefined
    responseText: ""
    responseXML: undefined

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

      0  

    Default


    Perhaps this is all because these calls are being done cross-domain.

    I want to reiterate, when I hack the code to make it so the iframe, which Ext.Ajax.request creates for uploads, is visible and doesn't remove itself, the XML is there. The browser is reading it. It's a REST response.

    My problem is that Ext is telling me that it's not there.

  9. #29
    Ext User
    Join Date
    Dec 2007
    Posts
    6
    Vote Rating
    0
    dan1son is on a distinguished road

      0  

    Default


    Not sure if this is related, but I was having basically the same problem, but with JSON responses and file uploads on IE7/8. All of my headers were correct (html and utf-8), but for some reason the responseText was still empty. I was returning a status of 400, success flag false, and some json response text. This triggered the "success" handler (which I believe is documented) but caused a Syntax error on IE during json decode since it was an empty string.

    I changed the response status to 200 (success, even though it was a failure) and everything works fine. We already had code checking the success flag on our success handler since fileUpload calls always trigger the success handler. So I suggest forcing success, if that's not what you're already doing.

  10. #30
    Ext User
    Join Date
    Jun 2007
    Posts
    24
    Vote Rating
    0
    ryedin is on a distinguished road

      0  

    Default Same problem, please help (PRETTY PLEASE, with sugar on top....)

    Same problem, please help (PRETTY PLEASE, with sugar on top....)


    I have the exact same issue, but my request is NOT being made cross domain. The actual domain is changed here, but basically, I have a page at "foo.bar.baz.com", and then I'm creating an Ext form on the page, which has a file input, and programmatically calling form.submit(). The url of the form is "/somepage.html" -- which of course means it's in the same domain.

    I traced the issue to the same chunk of code the OP of this thread did, and I've determined that for some weire reason (and in all browsers)... the document property (and window, and other properties) of the iframe are marked as "Access Denied" (which to me looks like the browser is treating the issue as cross domain.

    So can someone explain why this might be happening? Is it because I'm using a domain with multiple subdomains? That seems odd to me if that's the actual issue here.

    Anyone?
    Ryan Gahl
    Manager, Senior Software Engineer
    Nth Penguin, LLC
    www.nthpenguin.com
    ---
    Architect
    WebWidgetry.com / Mashupstudio.com
    Future Home of the World's First Complete Web Platform
    ---
    Blog: http://www.someElement.com
    Inquire: 262-951-6727