I need to write an upload angular module that uses spring boot controller and multipart file. But when I am uploading the file i have an error
Current request is not a multipart request
I tried alot of changes but every time I get this error. Here is my angular file sender data service
function uploadFile (file) {
var deferred = $q.defer();
var fd = new FormData();
fd.append('file', file);
$http({
data : fd,
method: 'POST',
transformRequest: angular.identity,
url: "/api/private/upload",
contentType: false,
processData: false
}).then(function (response) {
deferred.resolve(response.data);
}, function (response) {
deferred.reject(response.message);
}).catch(function (response) {
deferred.reject(response.message);
});
return deferred.promise;
}
And here is my Controller
public String singleFileUpload(@RequestParam("file") MultipartFile file) {
return "redirect:/uploadStatus";
}
It is not working with or without multipart Resolver. Can you please help me with this file upload.