SpringBootBucket icon indicating copy to clipboard operation
SpringBootBucket copied to clipboard

保存图片到本地会报FileNotFoundException

Open SunHongmin opened this issue 4 years ago • 0 comments

file reference

com.xncoding.echarts.service.ApiService#saveBase64Pic ######原始代码 String destFile = p.getImageDir() + now + ".png"; out = new FileOutputStream(file); ######产生原因 文件路径不存在时 输出流输出到文件时会报错 ######更改建议 String destFile = p.getImageDir() + now + ".png"; File file = new File(destFile); if(!file.getParentFile().exists()){ file.getParentFile().mkdirs(); } out = new FileOutputStream(file);

issues提交时间 2020-06-03

SunHongmin avatar Jun 03 '20 02:06 SunHongmin