West Ham have confirmed striker Carlton Cole is leaving Upton Park this summer after seven years at the club.