The present invention relates to a topical film-forming composition including, in a pharmaceutically acceptable medium: 5 to 30 wt % of ethyl cellulose; 0.1 to 10 wt % of an auxiliary film-forming agent; 0.1 to 20 wt % of one or more triacids, at least one of which is boric acid; and 60 to 95 wt % of an organic solvent, the percentages being expressed by weight relative to the total weight of the composition. The invention also relates to the use of such a composition in a method for treating herpes, in particular herpes labialis.