对应上传代码
public String uploadInfo(MultipartFile upload) throws IOException {
//判断文件是否为空
if (upload.getSize() > 0) {
// 根据上传全路径,获取真实文件名+后缀
String str = "\\";
String substring = upload.getOriginalFilename().substring(upload.getOriginalFilename().lastIndexOf(str)+1);
//判断文件是否存在 如果已经存在,先删除
File temp = new File(picturePo.getPictureLocal() + "/" + substring);
if (temp.exists()) {
temp.delete();
}
//将文件写入到指定路径
FileOutputStream out = new FileOutputStream(picturePo.getPictureLocal() + "/" +substring );
out.write(upload.getBytes());
out.flush();
out.close();
return substring;
}else {
return "";
}
}
对应下载代码
@RequestMapping("/show")
public void