Hello,
I have Drupal 7.8 and it is up and running without a problem. What I would like to do is to attach the files in my non-drupal folder when I create an article. The module COPIES the file from the non-drupal directory to /sites/default/files. I do not want to copy the existing files, I just want to be able to attach them to nodes.
I want to keep my non-drupal folder as is because I upload through FTP mp3 files 3-4 times a week and the folder is all organized like:
Folder 1
- Sub Folder 1
- Sub Folder 2
Folder 2
- Sub Folder 1
- Sub Folder 2
...
How can I keep uploading mp3 files to my non-drupal folder (i.e. domain.com/folder) and attach these files to nodes without copying them to the default public directory? I have also tried to select the default folder as my non-drupal folder but it didn't work too.
Thanks in advance!
Ponderer
Comments
Comment #1
pondereradam commentedI'm really desperate on this issue. I've been thinking and googling for a solution for more than 2 months. Any help is appreciated. Thanks!
Comment #2
royep commentedSearching a solution as well
Comment #3
dman commentedI don't believe this is possible under the File Wrapper API. At least, I've not seen any way to do this.
ALL filefield entries are managed files.
ALL managed files have a Drupal file wrapper URI, such as "public://uploads/file.ext" which is matched by system internals to "sites/default/files/uploads/file.ext" when needed, but all the Drupal file functions try to hide that from you.
The upshot is : You just CANNOT make a filefield attachment refer to a file that is outside of the drupal files directory. Without serious hacks.
For you - either modify your FTP upload path so it IS somewhere inside sites/default/files and your two methods will agree about what files are where
OR -add a symlink to achieve the same effect.
OR - find or write your own file API wrapper that will allow this. The file API wrappers are actually designed with this in mind (arbitrary "file" storage in arbitrary places), so it may be the industrial-strength general-case answer to your underlying requirements.
Comment #4
quicksketchYep, dman sums it up correctly. When you attach a file to a File field, you're granting the field full power over that file (including deleting it if the corresponding node is deleted). If you're working with completely arbitrary files, then you might use a Link field, but that obviously isn't going to have the full flexibility of a file field. The only other option is writing a custom stream wrapper, as he stated.