Replacing file instead of saving new file

I save an image to an image field in DB. Then I save a new image to the same file. The new image is added to the File Manager and the old image file is not deleted. After a number of testing, there are many “old” image files, thus increasing the storage space.

  1. Why is the old image not replaced with the new image instead?
  2. Is there an option to delete the old one and add the new one?
  3. If not, what can I do to delete the old image every time I save a new image?
  4. How do I clean up the DB if I have many old images laying around?

There’s an action called delete an uploaded file which is what you’re looking for. :wink:

1 Like

So I need to delete the image file in the field first and then save the new image file. Thank you!