Angularjs Fileupload изменить URL загрузки?

Я использую Angular для загрузки файла, как показано ниже:

Если я запускаю следующий код, я получаю 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'
    });
},
...

В консоли отладчика

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

Когда я изменяю код, как показано ниже, все в порядке.

...
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'
    });
},
...

0 ответов

Другие вопросы по тегам