public KwlReturnObject uploadFile(FileItem fi, String userid) throws ServiceException {
    Docs docObj = new Docs();
    List ll = new ArrayList();
    int dl = 0;
    try {
      String fileName = new String(fi.getName().getBytes(), "UTF8");
      String Ext = "";
      String a = "";

      if (fileName.contains(".")) {
        Ext = fileName.substring(fileName.indexOf(".") + 1, fileName.length());
        a = Ext.toUpperCase();
      }

      User userObj = (User) hibernateTemplate.get(User.class, userid);
      docObj.setDocname(fileName);
      docObj.setUserid(userObj);
      docObj.setStorename("");
      docObj.setDoctype(a + " " + "File");
      docObj.setUploadedon(new Date());
      docObj.setStorageindex(1);
      docObj.setDocsize(fi.getSize() + "");

      hibernateTemplate.save(docObj);

      String fileid = docObj.getDocid();
      if (Ext.length() > 0) {
        fileid = fileid + Ext;
      }
      docObj.setStorename(fileid);

      hibernateTemplate.update(docObj);

      ll.add(docObj);

      //            String temp = "/home/trainee";
      String temp = storageHandlerImplObj.GetDocStorePath();
      uploadFile(fi, temp, fileid);
    } catch (Exception e) {
      throw ServiceException.FAILURE(e.getMessage(), e);
    }
    return new KwlReturnObject(true, KwlReturnMsg.S01, "", ll, dl);
  }