How should I map form data request with multiple files and string params?
The request looks below, user can upload multiple files and each file belongs to user(array of user data in data param, in data there is file
param in each object)
Here data should be mapped in the list of User
class
public class User {
private String email;
private String fileName;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
and request mapping should like
@PostMapping(path = ExpertRestURI.EXPERT_SKILL, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity saveData(@ModelAttribute List<MultipartFile> files, @Valid List<User> users)
This is not working, any alternative solutions/suggestions for this kind of scenario?