Hello everyone,
I'm currently setting up a new Drupal site.
When we add attachment to a node whether we use Drupal upload module of CCK Field Field/Image Field module, the file will always be uploaded to /files/ directory. Imagine I've uploaded hundreds or thousands of files, it would take ages to view the directory trough FTP or CPanel.

I've look everywhere in the Modules section of this site, and still i haven't found any modules or tricks to enable me to choose directory location when I attach a file to a node. I'm I missing something or this is one thing that Drupal incapable of doing?

Thanks in advance :).

Comments

Tom-182’s picture

Still no answers yet? :(
I've try using http://drupal.org/project/uploadpath module, but still when i tried attaching a file to a node the file was uploaded to /files/ directory (I've configure the uploadpath module).

Sophia’s picture

Sorry redundant message

Leeteq’s picture

But if some programmer should be tempted to take a stab at it, perhaps you should make sure that you have described exactly how you would suggest such a feature should work, including which configuration options you would need/want for such a feature?

Perhaps a way of creating subdirectories in a "default" files directory based on x number of files, or simply when the file name passed a certain number?

Example:
After 1000* files in "drupalroot/filesfolderexample/topic1/a" , then
the next 1000 files will automatically be put in
"drupalroot/filesfolderexample/topic1/b" , and the "b" subdirectory will be automatically created when needed.
- etc.?

Also giving a configuration option to switch the current focus from topic1 to topic2 (or gallery1 to gallery2), or whatever, but still retain the paths to the previously uploaded files from their nodes?

*1000: this number must be configurable from the module settings.
The path must obviously be configurable.

Can multiple paths or a switch of the "root" files folder be done without changes to core?
Some of this seems to be relevant for file upload API in core.

PS. I am not updated on the recent discussions about file upload, so these things may be on their way to be resolved. Which main differences are there in Drupal 4, 5 and the coming v6 for this? (both ready in core, and what is made available for potential contributed modules to exploit?)

.
--
( Evaluating the long-term route for Drupal 7.x via BackdropCMS at https://www.CMX.zone )

papile’s picture

I myself have been writing code in my modules to move files into custom directories. It is unacceptable that uploads are dumped all into /files with no ability of changing the path dependant on any one thing. There should be at least something that can put the files in folders according to taxonomy (easy) Or ideally, do somethign similar to what pathauto does with urls (IE make dynamic paths according to what a field says ) Like if I have postings that have a volume and issue number, I should be able to have /files/[vol]/[iss]/picture.jpg. I can post code to show you how to move these files and update the files database if you are somewhat able to code. Like I have a hook_nodeapi trigger that when a node is saved, I can move the file from /files to the directory I want, then I update the files table to my new path.

With CCK being integrated in Drupal 6, this should be very possible and easy to have in core

setvik’s picture

Papile: I'd definitely be interested in your code.

Would you be willing to post/email it?

- stein

Leeteq’s picture

- do you mind sharing it here?

.
--
( Evaluating the long-term route for Drupal 7.x via BackdropCMS at https://www.CMX.zone )