If the external force is acting vertically then the work done by the external force is equal to the magnitude of the force times the vertical distance that it acts through. The fact that the magnitude of the force happens to be equal to the weight of the object (if we assume the velocity of the object is constant) is irrelevant.

So we have

Work done = force x increase in height = weight x increase in height = increase in potential energy of object

You can either think of this as work done by the force on the object or as work done by the force against gravity.