我尝试将图像从angularjs应用程序上传到Spring Boot端点,但我遇到了以下问题:
npm install
Angularjs代码:
{"timestamp":1522031262882,"status":400,"error":"Bad Request","exception":"org.springframework.web.multipart.support.MissingServletRequestPartException","message":"Required request part 'image' is not present","path":"/customer/uploadLogo"}
Spring-boot代码:
function uploadLogo(formdata) {
var formData = new FormData();
formData.append('image', $scope.picture);
return $http.post(defaultConfig.baseUrl + 'customer/uploadLogo', formdata, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined},
});
}
我通过"图像"在formData上,所以这个例外对我来说没有多大意义。有没有人有这样的事情?