I've been googling for this issue without any luck.
I have an HTML AngularJS 1.6 view posting to a Spring 4 REST POST service, trying to upload a JSON file.
<form ng-controller="fupController">
<input type="file" id="file" name="file" ng-files="getTheFiles($files)" />
<input type="button" ng-click="uploadFiles()" value="Subir archivo" />
</form>
And the backend:
@RequestMapping(value="/uploadForm", method=RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public @ResponseBody String handleFileUpload(@RequestParam MultipartFile file)
{
//MultipartFile file = null;
logInfo("uploaded file: " + file);
If I change it to @ModelAttribute instead of @RequestParam, the backend gets null in that parameter. If I change it to RequestBody 415 or 403 is thrown.
I'm stuck here. Any help would be very appreciated.