public String uploadImage() {

    System.out.println("1111" + albumId);
    HttpSession session = ServletActionContext.getRequest().getSession(false);
    User user = (User) session.getAttribute("user");
    System.out.println("UserPostAction Photo===>" + picFileName);
    System.out.println("UserPostAction Photo===>" + picContentType);
    System.out.println("UserPostAction Photo===>" + pic);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date dateobj = new Date();
    UserImageUploadDAO up = new UserImageUploadDAOImpl();
    String destpath = "";
    String imageExtension = "";
    if (picContentType != null && picContentType.contains("jpeg")) {
      imageExtension = ".jpeg";
    } else if (picContentType != null && picContentType.contains("png")) {
      imageExtension = ".png";
    } else if (picContentType != null && picContentType.contains("gif")) {
      imageExtension = ".gif";
    } else if (picContentType != null && picContentType.contains("jpg")) {
      imageExtension = ".jpg";
    }
    if (picFileName != null) {
      Random randomGenerator = new Random();
      Integer randomInt = randomGenerator.nextInt(1000000);
      picFileName = randomInt.toString() + imageExtension;
      System.out.println("UserPostAction Photo===>" + picFileName);

      String name = up.getAlbumName(getAlbumId());
      destpath = StringUtils.photoPath + File.separator + user.getUserId() + "_" + name;
      System.out.println("Server path:" + destpath);
      File destFile = new File(destpath, picFileName);
      try {
        FileUtils.copyFile(pic, destFile);
      } catch (IOException e) {
        System.out.println("error occurred");
        e.printStackTrace();
        return ERROR;
      }
    }
    // if(friendId==null || friendId=="")
    // {
    user_id = user.getUserId();
    setUser_id(user_id);
    up.uploadImage(df.format(dateobj).toString(), albumId, picFileName);
    Integer aid = albumId;
    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("albumId", aid.toString());
    request.setAttribute("imageList", imageList);

    // }
    // else{
    /*NewsFeedDAOImpl nfd=new NewsFeedDAOImpl();
    String userName=nfd.getFullUserName(friendId);

    up.postOnWall(postDesc, user.getUserId(),friendId,  df.format(dateobj).toString(),userName+" status Update","timeline",youtubeLink,picFileName);*/
    // }
    addActionMessage("Content has been posted successfully.");
    return "success";
  }
  public String uploadGroupImage() {

    System.out.println("pic upload action............1111111111111111111111111111111" + albumId);
    HttpSession session = ServletActionContext.getRequest().getSession(false);
    User user = (User) session.getAttribute("user");
    System.out.println("UserPostAction Photo===>" + picFileName);
    System.out.println("UserPostAction Photo===>" + picContentType);
    System.out.println("UserPostAction Photo===>" + pic);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date dateobj = new Date();
    UserImageUploadDAO up = new UserImageUploadDAOImpl();
    String destpath = "";
    String imageExtension = "";
    if (picContentType != null && picContentType.contains("jpeg")) {
      imageExtension = ".jpeg";
    } else if (picContentType != null && picContentType.contains("png")) {
      imageExtension = ".png";
    } else if (picContentType != null && picContentType.contains("gif")) {
      imageExtension = ".gif";
    } else if (picContentType != null && picContentType.contains("jpg")) {
      imageExtension = ".jpg";
    }
    if (picFileName != null) {
      Random randomGenerator = new Random();
      Integer randomInt = randomGenerator.nextInt(1000000);
      picFileName = randomInt.toString() + imageExtension;
      System.out.println("UserPostAction Photo===>" + picFileName);

      String name = up.getAlbumName(getAlbumId());
      destpath = StringUtils.groupPhotoPath + File.separator + group_id + "_" + name;
      System.out.println("Server path:" + destpath);
      File destFile = new File(destpath, picFileName);
      try {
        FileUtils.copyFile(pic, destFile);
      } catch (IOException e) {
        System.out.println("error occurred");
        e.printStackTrace();
        return ERROR;
      }
    }
    up.uploadImage(df.format(dateobj).toString(), albumId, picFileName);
    Integer aid = albumId;
    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("albumId", aid.toString());
    request.setAttribute("imageList", imageList);
    getGroupDetails();
    // addActionMessage("Content has been posted successfully.");
    System.out.println("action pic upload done................................................");
    return "success";
  }
  public void uploadProfileImage() throws IOException {

    System.out.println("1111" + albumId);
    HttpSession session = ServletActionContext.getRequest().getSession(false);
    User user = (User) session.getAttribute("user");
    System.out.println("UserPostAction Photo===>" + picFileName);
    System.out.println("UserPostAction Photo===>" + picContentType);
    System.out.println("UserPostAction Photo===>" + pic);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date dateobj = new Date();
    UserImageUploadDAO up = new UserImageUploadDAOImpl();

    int albumid = up.getAlbumId("profilePicture", Integer.parseInt(user.getUserId()));

    String destpath = "";
    String imageExtension = "";
    if (picContentType != null && picContentType.contains("jpeg")) {
      imageExtension = ".jpeg";
    } else if (picContentType != null && picContentType.contains("png")) {
      imageExtension = ".png";
    } else if (picContentType != null && picContentType.contains("gif")) {
      imageExtension = ".gif";
    } else if (picContentType != null && picContentType.contains("jpg")) {
      imageExtension = ".jpg";
    }
    if (picFileName != null) {
      Random randomGenerator = new Random();
      Integer randomInt = randomGenerator.nextInt(1000000);
      picFileName = randomInt.toString() + imageExtension;

      System.out.println("UserPostAction Photo===>" + picFileName);

      String name = "profilePicture";
      destpath = StringUtils.photoPath + File.separator + user.getUserId() + "_" + name;
      System.out.println("Server path:" + destpath);
      File destFile = new File(destpath, picFileName);
      try {
        FileUtils.copyFile(pic, destFile);
      } catch (IOException e) {
        System.out.println("error occurred");
        e.printStackTrace();
        // return ERROR;
      }
    }
    // if(friendId==null || friendId=="")
    // {
    up.uploadImage(df.format(dateobj).toString(), albumid, picFileName);
    boolean j = up.updateProfilephoto(user.getUserId(), picFileName);
    LoginDAO ld = new LoginDAOimpl();
    String picPath = StringUtils.RetrivePhotoPath;
    System.out.println("hello1111" + user.getPassword());
    user.setProfilePic(
        picPath + "/" + user.getUserId() + "_" + "profilePicture" + "/" + picFileName);
    // User user1=ld.isValidUser(user.getUserId(),user.getPassword());

    // session.removeAttribute("user");
    // session.setAttribute("user",user);
    // session.setAttribute("login", true);

    // System.out.println("helloooooooooooooo"+user1.getUserId()+user1.getCoverPic());

    Integer aid = albumid;

    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("albumId", aid.toString());

    // request.setAttribute("imageList", imageList);

    // }
    // else{
    /*NewsFeedDAOImpl nfd=new NewsFeedDAOImpl();
    String userName=nfd.getFullUserName(friendId);

    up.postOnWall(postDesc, user.getUserId(),friendId,  df.format(dateobj).toString(),userName+" status Update","timeline",youtubeLink,picFileName);*/
    // }
    // addActionMessage("Content has been posted successfully.");
    HttpServletResponse response = ServletActionContext.getResponse();
    response.sendRedirect(
        StringUtils.hostname + "/FacebookDemo/userNewsFeedAction?user_id=" + user.getUserId());
    /*if(j)
    return "success";
    else
    	return ERROR;*/
  }