I have an image field which has 1 value limited. I need to change the uploading photos frequently, and I hope the old images will not be removed. Is it possible to achieve this?

  • 1
    Drupal version?
    – No Sssweat
    Mar 22, 2018 at 8:57
  • Drupal version: 7
    – Juana Zhou
    Mar 26, 2018 at 6:51

2 Answers 2


It's not really clear what you're trying to achieve, but basically there are two ways to go:

  • Don't use an image field, but use an "entity relation" to a media entity instead. (Media is a core module >= Drupal 8.4, or a contrib module <= Drupal 8.3)
  • User revisions: Create a new revision of your node every time you update the image field. You then can view older versions of the image in the version history of your page.
  • "Contrib" means it is a community contribution, published on Drupal.org - The module's name is Media
    – Hudri
    Mar 26, 2018 at 7:13
  • Thanks Hudri so much for your quick response:) I'll take a try
    – Juana Zhou
    Mar 26, 2018 at 7:33
  • Dear Hudri, now I have the "Media" module. And I added a "File" field and select "Media Browser" widget. while editing this "File" field there are 2 buttons -- "remove" and "edit". I tried the "edit" function, I re-uploaded a new image, and the former uploaded image is removed. Is it possible not to remove the former one?
    – Juana Zhou
    Mar 27, 2018 at 5:54
  • You should not edit, but remove and create a new media entity. I don't know about this module in D7, but in D8 there is an option to hide the edit button in the form display settings.
    – Hudri
    Mar 27, 2018 at 8:20
  • Thanks Hudri, actually I want to keep but not remove the old uploaded images. Is that possible?
    – Juana Zhou
    Mar 28, 2018 at 1:28

For those who really think that they want to hack core: Open includes/file.inc and look for the function drupal_unlink. Add return FALSE; as the first line and NO files will be deleted. Better yet, add a conditional statement that checks the $uri to ensure that it is a file that you don't want to delete.

I got above solution here, How to keep underlying file when deleting a Filefield value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.