The files folder is currently a place where Drupal puts whatever is upload through its upload system.

The problem is that all files are mixed in one folder. For sites with thousands of nodes, it quickly becomes a problem to not have a more advanced hierarchy.

The idea is that Drupal should allow the administrator to optionally specify a subfolder in any different form that allows file uploading and for any defined taxonomy.

Comments

webchick’s picture

Version: 4.7.4 » 6.x-dev

Yeah, it probably should; however, new features only go into the development version.

In the meantime you could do this with a module that acts on hook_nodeapi op submit and switches the file destination.

umonkey’s picture

Taxonomy is of no use here. I believe there should be a folder per node, user, theme etc.

pasqualle’s picture

Version: 6.x-dev » 7.x-dev
neural’s picture

Why not "content type/nodeid"?

The files folder would then look like this:

-..
-forum
----nodeid1
----nodeid2
-page
----nodeid3
----nodeid4
-story
----nodeid1
----nodeid2
-themes
----garland
----bluemarine
-user
----username1
----username2

The themes folder would hold logos and other theme related files.

The user folder would hold profile pictures and other files related to users.

dopry’s picture

because files are not strictly associated to nodes... I recommend a hash on the first few letters of a filename. Say
/path/to/file.jpg becoming /path/to/f/i/l/file.jpg. You could also implement this as a stream wrapper around the normal file handling.

webchick’s picture

That makes for icky user-facing URLs.

Since this is one of those "everybody's got a use case" problems, it'd make the most sense to make this user-configurable in the same way that FileField does.

Ideally, this would involve #113614: Add centralized token/placeholder substitution to core, but even if upload.module was allowed to be configured per-node-type with a hard-coded filepath (art, photos, etc.), that would be a vast improvement.

dave reid’s picture

Status: Active » Fixed

This is now solved in Drupal 7 core. The file upload directory now allows tokens and other contrib modules allow even more exhaustive solutions.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.