Allow existing files to be attached
Hello, Is there a module that allows users to attach existing files to node? The upload module only allows you to attach file from your computer, not existing files in /files. Isn't it a very common use case ? The upload ui could be like this : - Upload a file from your computer (current upload box) or - Attach an existing file from your site (some sort of ajax search system + file path text input form as a fallback for js disabled browsers) I can work on this as a contrib module, but it's strange this has not been made already. I want a compatible solution with core upload module. Did I miss something? I wanted to ask before working on it so I don't reinvent the wheel. Thank you Philippe
Currently the only module I know that provides this functionality is the the disknode module, though it's not very flexible in that you're required to use the created disknode content type. http://drupal.org/project/disknode Wim Quoting Philippe Jadin <philippe.jadin@gmail.com>:
Hello,
Is there a module that allows users to attach existing files to node? The upload module only allows you to attach file from your computer, not existing files in /files.
Isn't it a very common use case ?
The upload ui could be like this :
- Upload a file from your computer (current upload box) or - Attach an existing file from your site (some sort of ajax search system + file path text input form as a fallback for js disabled browsers)
I can work on this as a contrib module, but it's strange this has not been made already. I want a compatible solution with core upload module.
Did I miss something? I wanted to ask before working on it so I don't reinvent the wheel.
Thank you
Philippe
Currently the only module I know that provides this functionality is the the disknode module, though it's not very flexible in that you're required to use the created disknode content type.
Is there a module that allows users to attach existing files to node? The upload module only allows you to attach file from your computer, not existing files in /files.
That is not limited to upload module. CCK's Imagefield could benefit from a more generic approach, too. It is also using the files table. See http://drupal.org/node/119539 for the related issue. Daniel
Not it is not possible to safely share files tracked by Drupal in D5 and below. There are changes in D6 that make this possible, but no interface has been written for it yet. On Thu, 2007-12-06 at 13:56 +0100, Philippe Jadin wrote:
Hello,
Is there a module that allows users to attach existing files to node? The upload module only allows you to attach file from your computer, not existing files in /files.
Isn't it a very common use case ?
The upload ui could be like this :
- Upload a file from your computer (current upload box) or - Attach an existing file from your site (some sort of ajax search system + file path text input form as a fallback for js disabled browsers)
I can work on this as a contrib module, but it's strange this has not been made already. I want a compatible solution with core upload module.
Did I miss something? I wanted to ask before working on it so I don't reinvent the wheel.
Thank you
Philippe
On Dec 6, 2007 2:46 PM, Darrel O'Pry <dopry@thing.net> wrote:
Not it is not possible to safely share files tracked by Drupal in D5 and below. There are changes in D6 that make this possible, but no interface has been written for it yet.
Could you explain what is not safe or give some pointers? Thank you Philippe
On Dec 6, 2007 8:11 AM, Philippe Jadin <philippe.jadin@gmail.com> wrote:
On Dec 6, 2007 2:46 PM, Darrel O'Pry <dopry@thing.net> wrote:
Not it is not possible to safely share files tracked by Drupal in D5 and below. There are changes in D6 that make this possible, but no interface has been written for it yet.
Could you explain what is not safe or give some pointers?
If multiple modules are sharing a file there's no way for them to know that another is using it. So when a node with a file is attached is deleted, any other modules' nodes that are using that file will be left with a database record but no file. I'm not sure what changes dopry is referring to, as far as I know D6 has the same problem. Unresolved issues on how to handle deletion were what held up the patch to add a hook_file: http://drupal.org/node/142995 andrew
On Dec 6, 2007 5:44 PM, andrew morton <drewish@katherinehouse.com> wrote:
If multiple modules are sharing a file there's no way for them to know that another is using it. So when a node with a file is attached is deleted, any other modules' nodes that are using that file will be left with a database record but no file.
I'm not sure what changes dopry is referring to, as far as I know D6 has the same problem. Unresolved issues on how to handle deletion were what held up the patch to add a hook_file: http://drupal.org/node/142995
I looked at upload_delete in both D5 and D6 and it seems they both delete files when they are not attached to the node being deleted. The rule could be changed to delete the file only if it not used in *any* node. A module with higher priority than upload could do some magik in the file_versions / upload table with a delete hook to avoid this. This could work without touching core. I think files could be made available to more than one node to avoid uploading the same file multiple times. Is it wrong vs the Drupal philosophy ? I'd better know before working on a module :-) Philippe
andrew
No, but you could have reviewed the hook_file patch several months ago, when there was still a chance for it to get into D6. http://drupal.org/node/142995 which I have even been keeping up to date with head if you want to review it now... On Thu, 2007-12-06 at 19:38 +0100, Philippe Jadin wrote:
On Dec 6, 2007 5:44 PM, andrew morton <drewish@katherinehouse.com> wrote:
If multiple modules are sharing a file there's no way for them to know that another is using it. So when a node with a file is attached is deleted, any other modules' nodes that are using that file will be left with a database record but no file.
I'm not sure what changes dopry is referring to, as far as I know D6 has the same problem. Unresolved issues on how to handle deletion were what held up the patch to add a hook_file: http://drupal.org/node/142995
I looked at upload_delete in both D5 and D6 and it seems they both delete files when they are not attached to the node being deleted. The rule could be changed to delete the file only if it not used in *any* node. A module with higher priority than upload could do some magik in the file_versions / upload table with a delete hook to avoid this. This could work without touching core.
I think files could be made available to more than one node to avoid uploading the same file multiple times. Is it wrong vs the Drupal philosophy ? I'd better know before working on a module :-)
Philippe
andrew
You might want to check out how IMCE works (it isn't limited to images). cheers, -tao Philippe Jadin wrote:
Hello,
Is there a module that allows users to attach existing files to node? The upload module only allows you to attach file from your computer, not existing files in /files.
Isn't it a very common use case ?
The upload ui could be like this :
- Upload a file from your computer (current upload box) or - Attach an existing file from your site (some sort of ajax search system + file path text input form as a fallback for js disabled browsers)
I can work on this as a contrib module, but it's strange this has not been made already. I want a compatible solution with core upload module.
Did I miss something? I wanted to ask before working on it so I don't reinvent the wheel.
Thank you
Philippe
Philippe Jadin wrote:
Hello,
Is there a module that allows users to attach existing files to node? The upload module only allows you to attach file from your computer, not existing files in /files.
You can look at WebFM. http://drupal.org/project/webfm Even allows you to create new folders, move things around. AND if you attach a file to more than one node, it will maintain its link to the file even if you move it around in the files subdirectories. andre
participants (7)
-
Andre Molnar -
andrew morton -
Daniel F. Kudwien -
Darrel O'Pry -
Philippe Jadin -
Tao Starbow -
Wim Mostrey