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