On the page admin/content/media I'm trying to remove a file, and I get the following warning:

The file x.jpg is in use and cannot be deleted.

We've been struggling with this issue for some time now, and it looked like the root of the problem was related to the list of revisions in the node the file was in. Deleting the revisions enabled us to delete the file.

Has anybody experienced this issue? Is there a way to fix it?

It's not a great idea for us to have to remove all previous revisions of a node in order to just delete some duplicated files from the media library.

1 Answer 1


To be honest this is the behaviour that should be expected of the field/revision system.

If you have an image file that is attached to a node revision, Drupal (rightly) makes sure that another process in the system cannot delete it. If this wasn't done you'd end up with incomplete/erroneous node revisions.

The only options you've got (in terms of the UI anyway) are either deleting the revisions (which you already know about), or removing the reference to the file from the revision(s) in question.

If you're feeling brave you could dive straight into these tables and make the changes manually:

  • node
  • node_revision
  • field_data_field_FIELDNAME
  • field_revision_field_FIELDNAME

But I strongly advise you only go down that route if you really, really know what you're doing, and have a good backup system in place :)

  • Ok, thanks. This is for a client, so it has to be really user friendly (no tables!). It would be good if there was a way to see a list of all nodes/revisions where a particular files is referenced, as sometimes they are having trouble removing all references. Commented Mar 13, 2012 at 10:24

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.