IMCE is awesome! Thanks for all your work.

Is there a way to use IMCE to add attachments to nodes and comments. I have it setup perfectly with WYSISYG and TinyMCE and IMCE TinyMCE Bridge. However the users cannot add attachments this way. It would be great if IMCE could work with nodes and comments and allow the user to upload files to and from their directory just like they do with the Drupal.org issues.

I tried out "IMCE Image" module which adds a CCK field to nodes but that solution will not work for comments (that I know of) and also appears to be tailored (hence the name) to images specifically.

Comments

adamo’s picture

I use a combination of CCK, Filefield, ImageField, Filefield Sources, and IMCE to do this. Works great with nodes. Could work for comments if you used the Node Comments module (but I haven't tried that).

There are a couple of caveats. First, recent versions of the Filefield module will only allow you to add files that were uploaded using the Filefield module. You can't select a file you uploaded through IMCE without commenting out one line in the Filefield source. More info here: http://drupal.org/node/441280

The other thing is that if you remove a file from a node and there are no other modules referencing that file, Filefield will remove the file from the server. Adding files to a node body through IMCE via a WYSIWYG editor isn't going to create the kind of reference Filefield checks for, so you could end up losing files that you need if they are added to a Filefield and then removed later. To get around this I implement hook_file_references in my tweaks module and have it always report that it has a reference to every file. That way no files are never automatically deleted from the server. Here's what the function looks like:

function lntw_tweaks_file_references($file) {
  return array('lntw_tweaks' => 1);
}
ufku’s picture

Status: Active » Closed (fixed)

Closing 6.x-1.x issues as this branch is no more supported.