Herein we report the fabrication of g-C3N4 nanofilms and their application as a solid fluorescence sensor. The as-prepared films are capable of convenient, sensitive, selective, rapid and recyclable sensing of Cu(2+) and Ag(+) in water and serum, indicating the sensor's potential application in disease diagnosis. Attractively, our sensor is able to differentiate Cu(2+) and Ag(+) by making use of their different adsorption and desorption kinetics during the interaction with g-C3N4 nanofilms.