我试图使用$ http获取文件,我在另一个应用程序中测试了我的代码并且它运行良好但在我的应用程序中我收到此错误:
这是我的代码:
app.controller("directoryCtrl", ["$scope", "$http", "Restangular", "langFctr", "$translate", function($scope, $http, Restangular, langFctr, $translate) {
$scope.uploadFile = function(files) {
var fd = new FormData();
fd.append("file", files[0]);
$http.post("/input", fd, {
withCredentials: true,
headers: {'Content-Type': undefined },
transformRequest: angular.identity
}).then(function successCallback(response) {
console.log("ok");
}, function errorCallback(response) {
console.log(response);
});
};
}]);