| | |
| | | AttachEntity ae = getAttachEntity(ue, tabName, eventid, fileName, md5, sizes); |
| | | if (entity != null) { |
| | | ae.setPath(entity.getPath()); |
| | | newFile.delete(); |
| | | }else { |
| | | |
| | | String oldPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); |
| | | File f = new File(oldPath); |
| | | if (!f.exists() || f.isDirectory()) { |
| | | newFile.renameTo(new File(oldPath)); |
| | | } else { |
| | | newFile.delete(); |
| | | } |
| | | } else { |
| | | String targetPath = pathHelper.getConfig().getUploadPath() + File.separator + ae.getPath(); |
| | | newFile.renameTo(new File(targetPath)); |
| | | } |
| | |
| | | entity.setTabGuid(eventid); |
| | | entity.setName(fileName); |
| | | entity.setGuid(md5); |
| | | String subPath = PathHelper.getUploadPath() + File.separator + md5+ FileHelper.getExtension(fileName); |
| | | String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(fileName); |
| | | entity.setPath(subPath); |
| | | entity.setSizes(sizes); |
| | | if (ue != null) { |