can we send image in json in angular 1

can we send image in json in angular

public ResponseEntity handleFileUpload(@RequestPart("user") User user, @RequestPart("file") MultipartFile file)

Here is what the above code is Doing:
1. The @RequestPart annotation is used to bind the “user” part of the request to the user object.
2. The @RequestPart annotation is used to bind the “file” part of the request to a MultipartFile object.
3. The MultipartFile object is used to get the original filename, content type, and the byte[] of the file.
4. The byte[] is then used to create a File object.
5. The File object is then used to create a FileMeta object.
6. The FileMeta object is then added to the user object.
7. The user object is then saved to the database.
8. The user object is then returned as a response.

Similar Posts