I want to upload a file using ng-file-upload, and send at the same time a list of values (type Long).
I have done that:
Client side
vm.uploadFiles = function(file, errFiles) {
$scope.f = file;
$scope.errFile = errFiles && errFiles[0];
if (file) {
file.upload = Upload.upload({
url: '/api/sendMailCra',
fields: {'collaborateursId':vm.collaborateursId},
file: file
});
file.upload.then(function (response) {
$timeout(function () {
file.result = response.data;
});
}, function (response) {
vm.clear();
}, function (evt) {
});
}
}
Server side
@RequestMapping(value = "/sendMailCra",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public void upload(@RequestParam("collaborateursId") List<Long> collaborateursId, @RequestParam("file") MultipartFile file) throws IOException {
log.debug("REST send mail to Collaborateurs : {}"+collaborateursId);
}
I am getting a
500 Internal server error
with no error log on server side.
How can I pass my List from client to server side?
Thanks