2

I use angular to upload the file as below :

If I run the following code, I get 403(Forbidden)

var contextRoot = "http://localhost\\:6060/nomunoli";
...
...
uploadFile : function(taglist, description, userid, file) {
    return $upload.upload({
        url : contextRoot + "/auth/insertNMNL001FUN02",
        fields : {
            'description' : description,
            'userId' : userid,
            'tagList' : taglist,
        },
        file : file,
        fileFormDataName : 'file'
    });
},
...

In debugger console

POST http://localhost/:6060/nomunoli/auth/insertNMNL001FUN02 403 (Forbidden)
    b   @   angular.min.js:79
    s   @   angular.min.js:74
    c.$get.f    @   angular.min.js:71
    l.promise.then.J    @   angular.min.js:101
    (anonymous function)    @   angular.min.js:102
    a.$get.h.$eval  @   angular.min.js:113
    a.$get.h.$digest    @   angular.min.js:110
    a.$get.h.$apply @   angular.min.js:113
    (anonymous function)    @   angular.min.js:195
    n.event.dispatch    @   jquery-2.1.3.min.js:3
    n.event.add.r.handle    @   jquery-2.1.3.min.js:3

When I change the code as below, it is OK.

...
uploadFile : function(taglist, description, userid, file) {
    return $upload.upload({
        url : "http://localhost\\:6060/nomunoli/auth/insertNMNL001FUN02",
        fields : {
            'description' : description,
            'userId' : userid,
            'tagList' : taglist,
        },
        file : file,
        fileFormDataName : 'file'
    });
},
...
4
  • Two different types of slashes? You are using both ` and /` in your URL. Also, is there a slash required when specifying the port? Commented Sep 9, 2015 at 3:41
  • Yes, I need to specifying the port. Later, we will use address:port Commented Sep 9, 2015 at 3:45
  • One issue: There shouldn't be a slash between the domain (localhost) and the port (6060). Commented Sep 9, 2015 at 3:46
  • Later, I have to use global IP address and port to access the server side. Commented Sep 9, 2015 at 3:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.