Struts2 上传图片
上传工具:UploadFileUtils
对应的jsp中上传图片的form
注意form的enctypeif(!UploadFileUtils.checkFileImg(headPictureContentType)){setRequestAttr("modfiyheadMSG", "图片类型错误。");return personalInt();}if(!UploadFileUtils.checkFileSize(headPicture)){setRequestAttr("modfiyheadMSG", "图片太大。");return personalInt();}//调用上传工具上传图片String newFileName = UploadFileUtils.setUploadFile(getRequest(),headPicture, headPictureFileName,Constants.HEADPATH);ClubUser user = getSessionUser();user.setUimg(newFileName);userMng.update(user);