ajax code -
var formData = new FormData();
formData.append('name', "DOG");
// ...
formData.append('file',file[0]);
// contentType: 'multipart/**',
$.ajax({
type: "POST",
url: "rest/user/upload",
data: formData,
processData: false,
contentType: false,
enctype: 'multipart/form-data',
success: function(response) {
console.log(response);
},
error: function(errResponse) {
console.log(errResponse);
}
});
SPRING ERROR : A message body reader for Java class org.springframework.web.multipart.MultipartFile, and Java type interface org.springframework.web.multipart.MultipartFile, and MIME media type multipart/form-data; boundary=----WebKitFormBoundaryG1QTOMPq2FNC5Z1j was not found. The registered message body readers