以下のように角度を使用してファイルをアップロードします。
次のコードを実行すると、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
以下のようにコードを変更すると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'
});
},
...