if(photo!=null){
String realpath = ServletActionContext.getServletContext().getRealPath("/factory/photo") ;//获取服务器路径
String targetFileName =StringUtil.getUuid()+"."+photoFileName.substring(photoFileName.lastIndexOf(".")+1);
target = new File(realpath, targetFileName);
FileUtils.copyFile(photo, target);
drug.setHeaderImg("factory/photo/"+targetFileName);
}
String realpath = ServletActionContext.getServletContext().getRealPath("/factory/photo") ;//获取服务器路径
String targetFileName =StringUtil.getUuid()+"."+photoFileName.substring(photoFileName.lastIndexOf(".")+1);
target = new File(realpath, targetFileName);
FileUtils.copyFile(photo, target);
drug.setHeaderImg("factory/photo/"+targetFileName);
}