I want to send a POST request from my service to a SpringBoot @RestController. I have a bunch of string parameters that I am sending, but I also have a FormData parameter which is an image (picture argument). If I do it like this:
public createEvent(name, description, fromDate, toDate, userId, picture){
this.http.post(this.baseUrl + 'create',
{
name: name,
description: description,
fromYear: fromDate['year'],
fromMonth: fromDate['month'],
fromDay: fromDate['day'],
toYear: toDate['year'],
toMonth: toDate['month'],
toDay: toDate['day'],
userId: userId,
picture: picture
}).subscribe();
}
And my Controller method looks like this:
@PostMapping(value = "/create")
public void createEvent(@RequestBody Map map){}
and I can't get the file.
I can send the FormData as a single parameter in a post request and receive it as a Multipart file in my controller without any problems, but is it possible to send it in the same request with the other parameters?
