SessionContainer session = reqCont.getSessionContainer();
SessionContainer permanentSession = session.getPermanentContainer();
IEngUserProfile profile = (IEngUserProfile) permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
//String userId=(String)profile.getUserUniqueIdentifier();
String userId=(String)((UserProfile)profile).getUserId();
ObjTemplate templ = null;
FileItem uploaded = (FileItem) request.getAttribute("UPLOADED_FILE");
if (uploaded != null) {
String fileName = GeneralUtilities.getRelativeFileNames(uploaded.getName());
if (fileName != null && !fileName.trim().equals("")) {
if (uploaded.getSize() == 0) {
EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "uploadFile", "201");
this.respCont.getErrorHandler().addError(error);
return null;
}
int maxSize = GeneralUtilities.getTemplateMaxSize();
if (uploaded.getSize() > maxSize) {
EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "uploadFile", "202");
this.respCont.getErrorHandler().addError(error);
return null;
}
templ = new ObjTemplate();
templ.setActive(new Boolean(true));
templ.setCreationUser(userId);
templ.setDimension(Long.toString(uploaded.getSize()/1000)+" KByte");
templ.setName(fileName);
byte[] uplCont = uploaded.get();
templ.setContent(uplCont);
}
}
// UploadedFile uploaded = (UploadedFile) request.getAttribute("UPLOADED_FILE");
// if (uploaded != null) {