The propulsive dynamics of a flexible undulating foil in a self-propelled swimming configuration near a wall is studied experimentally. Measurements of the swimming speed and the propulsive force are presented, together with image acquisition of the kinematics of the foil and particle image velocimetry (PIV) in its wake. The presence of the wall enhances the cruising velocity in some cases up to 25% and the thrust by a 45%, for swept angles of 160 and 240 degrees. The physical mechanisms underlying this effect are discussed by studying the vorticity dynamics in the wake of the foil. Proper orthogonal decomposition is applied to the PIV measurements in order to analyse the kinetic energy modal distribution in the flow and to relate it to the propulsion generated by the foil.