I need to send a file using multipar file which my spring controller expects.
public void test(@RequestParam("file") MultipartFile file) {}
I know that I have to use FormData, but I did not manage to make it work. Here's my code:
this.headers = new Headers({ 'Content-Type': 'multipart/form-data'});
this.options = new RequestOptions({ headers: this.headers });
return this.http.post(environment.SERVER_ENDPOINT + 'parameters/area', formData, options)
.toPromise()
.then(this.extractData)
.catch(this.handleError);