UploadedFile file = event.getFile();
if (file != null)
{
DocumentInfo dataInfo = new DocumentInfo();
dataInfo.setData(file.getContents());
dataInfo.setDocumentName(file.getFileName());
dataInfo.setSize(file.getSize());
dataInfo.setOwnerName(employee.getEmployeeName());
dataInfo.setOwnerId(employee.getEmployeeId());
dataInfo.setUplodedDate(new Date());
service.insertData(dataInfo);
FacesMessage msg = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);