West Ham United striker Carlton Cole has confirmed he is leaving Upton Park after seven years with the club.