MultipartFile photo 报错 File has been moved - cannot be read again
Spring mvc 的上传附件
方法:
if(photos.getSize() != 0){
String name = photo.getOriginalFilename();
String str = name.substring(0,name.lastIndexOf("."));
int idx = name.lastIndexOf(".");
String extention= name.substring(idx);
String logoName = str + extention;
String logoPath = basePath+enclosurePath;
String rfilename = logoPath+logoName.trim();
String fileName= enclosurePath+logoName;
File file3 = new File(rfilename.trim());
if (!file3.exists()) {
file3.createNewFile();
}
photos.transferTo(file3);
activity.setPhoto(fileName);
}
上传服务器 报错 phots.tansferTo(file3)
File has been moved - cannot be read again