how to add multiple files with array of form data angular spring boot?

  angular, windows

@PostMapping(value = "/upload1", consumes = { "multipart/form-data","application/json" })
public Employee uplaodFile1(@RequestPart("employee") EmployeeModel[] employee,
@RequestPart("file") MultipartFile[] files) {
return ;
}

for (let index = 0; index < event.target.files.length; index++) {
formData.append("file", event.target.files[index]);
formData.append(’employee’,new Blob([JSON.stringify({empName:’sdfds’+index,fileType:’sfsds’+index})], {
type: "application/json"
}));

}

i want to sent post request from angular
and how to send request from angular

Source: Windows Questions

LEAVE A COMMENT