Last updated November 7, 2008. Created by HansBKK on October 24, 2008.
Log in to edit this page.

Most module developers are very reluctant to have more than one node referencing a given file. The issue seems to be that the current (pre-D7) file-handling code in core doesn't give backward references, so a module can't tell if it's safe to delete the file or not when a given node is deleted.

Apparently core file-handling code may have changed to some extent with D6, but in practice, image-handling modules have yet to actually allow a direct link between one image file and multiple nodes.

Asset module is somewhat of an exception, and both the D5 and D6 versions handle this by tracking the Asset-managed files independently of the nodes referencing them; although the files are tracked by fid in the files table, they are all assigned to a non-existent node (number 0), so in fact there is no such thing as a "containing" node (see File-to-node relationship for more info).

Currently there is no one module that will help manage files that are "owned" by other modules. For example,WebFM only works with a set of files that it manages exclusively.

It is possible that these issues will be improved with the file-handling enhancements currently being developed for core D7; see also the examples of "killer features" page for some ideas along these lines.

So far these developments are just a new "framework for developers", and their capabilities have not yet been fully documented for non-technical users. If you want to do further research, here are some links to get you started:

http://www.civicactions.com/blog/files_getting_some_drupal_respect
http://drupal.org/node/142995
http://groups.drupal.org/node/15972

http://groups.drupal.org/file-api
http://groups.drupal.org/taxonomy/term/7
(one is an actual group, the other the taxonomy term)

http://api.drupal.org/api/group/file/7
http://api.drupal.org/api/search/7/hook_file

Search for more:
http://www.google.com/search?hl=en&q=7+files+API+site%3Adrupal.org

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.