1
2
3
4
5
6
7
8
9
private String saveImg(String base64Img) throws IOException {
String imgFile = "test.jpg";
try (FileOutputStream fos = new FileOutputStream(imgFile)) {
byte[] imageData = Base64.getDecoder().decode(base64Img);
fos.write(imageData);
fos.flush();
}
return imgFile;
}