I\'m trying to construct method for uploading file with some other form fields.
This is standard Html form with file and some other fields:
Your issues occurs cause your body is consumed when binding the values of the first argument, by ommiting the annotation for the dto the framework will instantiated and populate the matching properties from the request values
@ResponseBody
public MyDto createProduct(MyDto dto, @RequestParam MultipartFile file) {
}
note also that you can add a file property of the type MultipartFile to your MyDto instance, it will instantiate and bind correctly as well, so just
@ResponseBody
public MyDto createProduct(MyDto dto) {
}