/**
* 上传图片获取图片base64码,然后解码,然后转成字节数组,以流的形式输出到本地
* @return
* @throws Exception
*/
@RequestMapping(value = “/uploadYujhImg1”, method = RequestMethod.POST)
@ResponseBody
public EntityServiceResponse<Map<String, String>> uploadYujhImg1(String fileImg) throws Exception {
logger.info(“uploadYujh”+fileImg);
String imgBase64 = fileImg.replaceAll(“data:image/png;base64,”,"");
BASE64Decoder d = new BASE64Decoder();
byte[] data = d.decodeBuffer(imgBase64);
FileOutputStream os = new FileOutputStream(“D:\tupian\d.jpg”);
os.write(data);
os.close();
return null;
原文:https://blog.csdn.net/weixin_38933973/article/details/78120891