I was experimenting a little bit with uploading image to my server. I am sending image from postman as binary body. Content-type is image/png. What I do not know is how to fetch this image on in my controller. This is screenshot of how I am sending image.So the question is how to fetch this image from controller?
This is my code:
@PostMapping(path="/upload")
public String upload(HttpServletRequest httpServletRequest) {
//HOT TO FETCH IMAGE FROM HTTPSERVLET REQUEST HERE?
return "HOW TO FETCH IMAGE FROM CONTROLLER? ";
}
Thanks in advance:)
try this, to get the file
@PostMapping(path="/upload")
public String upload(@RequestParam("file") MultipartFile fil) {
}
to manipulate it, u just need to convert it to an InputStream Object
file.getInputStream()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.