Error under Network in chrome
{ timeStamp: ......, status: 400
error: \'Bad Request\',
message: \'Required request part \'file\' is not present\'
path:
Param annotation in your controller looks for a field called file.
Change selectFile to file will solve the problem.
formData.append("file", this.data);
Parameter name matters in this, it has to be same in both Java
& Angular
This:
formData.append("selectFile", this.data);
to that:
formData.append("file", this.data);
Cause
public ResponseEntity<String> handleFileUpload(@RequestParam("file")