How can I create http POST endpoint to send data like pictures in spring?
I checked different options and used its but I can not create it.
For example I used:
@Controller
@RequiredArgsConstructor
@RequestMapping("/web")
public class AuthenticationController {
@PostMapping(value = "/login", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void login(@RequestParam(value = "username") String userName,
@RequestParam(value = "password") String password) {
// NOP
}
}
CodePudding user response:
You can use like this
@PostMapping(value = "/login")
public void login(@RequestParam("document") MultipartFile document) {
enter code here
}