Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: “Permission Denied” error in IE when it enters failure block (Fileuploadfield)

  1. #1
    Sencha User
    Join Date
    Aug 2015
    Location
    India
    Posts
    24

    Default “Permission Denied” error in IE when it enters failure block (Fileuploadfield)

    Hi,
    I have used filefield xtype to upload a file and calling a web service. For my application, to handle success and failure block, i am using a variable 'success' such that if the value is true, it goes to the success block and if the value is false, it goes to the failure block. If i set the value success = false, it comes to failure block. But, when i decode the response it gives me "permission denied" error only in IE. In Chrome, we get the expected output even if it enters the failure block. Since i am getting this error, i am handling this failure case in success block itself.


    Below is the code snippet:
    Code:
    form.submit({
        headers : {
            "Accept" : "application/json; charset=utf-8"
        },
        url : 'calling a web service',
        waitMsg : 'Loading... Please Wait...',
        success : function (response, args) {
            var jsonResp = Ext.decode(args.response.responseText);
            if (jsonResp.exception) {
                Ext.create('widget.uxNotification', {
                    title : 'Failed',
                    height : 150,
                    width : 350,
                    html : '<span style="text-align:center; display:block;color:red">' + jsonResp.R.MSG + '</span>'
                }).show();
            } else {
                //actual code if success=true goes here
            }
        },
        failure : function (response, args) {
            var jsonResp = Ext.decode(args.response.responseText); //if i decode the response, i get permission denied
            var msg = jsonResp.R.MSG || jsonResp.R.Message; 
                    //R.MSG is undefined even if it is present in response and R.Message gives permission denied
            Ext.Msg.alert(msg);
        }
    });
    JSON Response for success case:
    Code:
    {  
       "success":true,
       "R":{  
          "MSG":"Success"
       }
    }
    JSON Response for failure case:
    Code:
    {  
       "success":true,
       "exception":true,
       "R":{  
          "MSG":"Failure"
       }
    }
    I am sending another parameter 'exception' in the response to handle this. So if exception is true then it's actually a failure case.


    Is it a bug in ExtJS library? Since i have seen the comments written in library file, stating that there is a problem with iframe.
    Can anyone help me on how to solve this IE issue?

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Are you getting any more to the error besides 'permission denied'? Is the domain of your upload URL the same as the domain of the application?

  3. #3
    Sencha User
    Join Date
    Aug 2015
    Location
    India
    Posts
    24

    Default

    "Permission Denied" is the only error I am getting. The domain is same.

  4. #4
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579
    Answers
    67

    Default

    You are probably sending the application/json instead of text/html content type. When you upload a file, it creates an iframe with a form and does a submit. It's not a normal ajax request. IE and some other browsers get confused by that.

    Edit:
    See this: I was wondering if it was in the docs anywhere. They recommend text/plain
    http://docs.sencha.com/extjs/5.0/5.0...thod-hasUpload

  5. #5
    Sencha User
    Join Date
    Aug 2015
    Location
    India
    Posts
    24

    Default

    I have tried using both application/json and text/html. Still I get the same error. I have attached a screen shot of the response, where I'm not able to change the accept type.
    Attached Images Attached Images

  6. #6
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579
    Answers
    67

    Default

    You are confusing request headers with response headers. Don't specify the accept headers at all and they will be correct. The response needs to be text/plain or text/html. This is done in you back-end code.

  7. #7
    Sencha User
    Join Date
    Aug 2015
    Location
    India
    Posts
    24

    Default

    As you mentioned, I have tried using the accept type as text/html and text/plain. It still won't work.

    Code:
    form.submit({
    	headers : {
    		"Accept" : "text/html; charset=utf-8"
    	},
       ...
    });

  8. #8
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579
    Answers
    67

    Default

    I'm not saying to do that. Your accept headers are not the problem. I am saying set your response headers in your back-end code. You are showing me Javascript. The fix is not in your Javascript code.

  9. #9
    Sencha User
    Join Date
    Aug 2015
    Location
    India
    Posts
    24

    Default

    The response headers are set to text/html. Still the same issue.

  10. #10
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579
    Answers
    67

    Default

    Quote Originally Posted by Nandu007 View Post
    The response headers are set to text/html. Still the same issue.
    Looks like I hit your same issue a year later and this is the only thread I see on it. Sorry I didn't dig deeper. The real issue that is happening is actually an IE "feature" which we can get around. Long story short, IE blows away your response and uses its own error. It is an entirely back-end fix. All that is needed to fix this problem to prevent this from happening is
    1: Don't send success flag so that it hits your failure callback
    2. Pad the response length to at least 512 bytes. I just added another property on my response json for this I called "paddingForIE"

    Here is Microsoft's page to describe what its doing:
    https://blogs.msdn.microsoft.com/iei...p-error-pages/

    I realize you may have solved this or worked around this by now, but I wanted to update this post to have the answer so people who run into it in the future have a solution

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 11
    Last Post: 15 Mar 2019, 11:47 PM
  2. Replies: 0
    Last Post: 21 May 2010, 3:57 AM
  3. Permission denied error for HTML editor
    By nikhilkrishnan in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 1 Apr 2009, 4:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •