upload
一.这是action中直接拷过来一段代码,因为一个FORM中还有很多东西,不过都不相关拉。FORM名称就是artMaintForm,UploadFile是在表单中的一个属性
if (artMaintForm.getUploadFile() != null) {
if (artMaintForm.getUploadFile().getFileName() != null
&& artMaintForm.getUploadFile().getFileName().trim().length()
!= 0) {
//Valid start 验证start
if (UploadHelper.checkUploadArtFileValid(artMaintForm)) {
throw new ArtServiceException("error.artService.checkFileTypeValid");
}
//Valid end 验证end
log.debug("-------upload good ======2=====");
uploadArtFile(artMaintForm);
}
}
二.
private void uploadArtFile(ArtMaintForm artMaintForm) {
//if (productForm.getArchiveFile() != null) {
log.info("-------------uploadArtFile start- 1--");
if (artMaintForm.getUploadFile() != null) {
log.info("-------------uploadArtFile start- 1.1--");
// afilePath artFilePath这个两个自己设定的路径
String afilePath =
(String) ConfigFactory.newConfig().getItem(
ArtConstant.SYSTEMCONFIG,
A