I try to upload/stream a large image to a REST controller that takes the file and stores it in to a database.
@Controller
@RequestMapping(\"/api/member/pictu
I have done this recently, see the details here.
On the browser we can make use of the file API to load a file, then encode its contents using Base64 encoding, and finally assign the encoded contents to a javascript object before posting it.
On the server, we have a Spring Controller which will handle the request. As part of the json unmarshalling that converts the the request body to a java object, the base64-encoded value for the image bytes will be converted to a standard Java byte[], and stored as a LOB in the database.
To retrieve the image, another Spring Controller method can provide the image by streaming the bytes directly.
The blog post I linked to above presumes you want to use the image as part of another object, but the principle should be the same if you want to only work with the image directly. Let me know if anything needs clarification.