how to send data using Postman in example DTO ,mainly Multipart file data,Angular 4,7
data in Multipartfile in Example DTO
public class ExampleDTo {
private MultipartFile image;
private String name;
private String description;
}
Controller Mapping
@PostMapping()
public ResponseEntity<?> saveExample(@RequestParam("dtoAnduploadingFiles") ExampleDTo dtoAnduploadingFiles ) throws IOException {
}
You can do it like a normal multipart
Form
from Postman but you need to update yourMapping Method
.For complete code example look here. And then you can test it on postman like this:
One way to do this is to use multiple multiparts.
So for example if you use this controller:
note: ExampleDto should contain only fields of json payload, not MultipartFile
In Postman you should use then form-data and choose file which you want to upload and also file with json payload.