I need to send a file using the multi-page file that my spring controller expects.
public void test(@RequestParam("file") MultipartFile file) {}
I know what I need to use FormData, but I was not able to get it to work. Here is 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);
source
share