This patch allows you to specify a subdirectory description of how you'de like the files to be saved. Handy for when different node types need to save the file to disk in different ways
The pathwill be appended to $_GLOBAL['file_directory_path'], mark it up with %username, %day, %dayname, %month, %monthname, %year . Blank if not required. Directories will be created, default (blank)
Example: somenodefiles/%year/%monthname/%username.
Will save as
$GLOBAL['file_directory_path']."/somenodefiles/2006/January/admin/somefile.pdf"
All filenames are preserved.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | flexinode_savepath_1.patch | 8.78 KB | ahoeben |
| #8 | image_savepath.patch | 3.45 KB | ahoeben |
| #7 | file_savepath.patch | 2.97 KB | ahoeben |
| #6 | flexinode_savepath_0.patch | 2.02 KB | ahoeben |
| #5 | flexinode_savepath.patch | 10.47 KB | ahoeben |
Comments
Comment #1
dgtlmoon commentedNo idea if or where the patch i attached to this node went so here it is for good measure
Comment #2
Bèr Kessels commentedThis looks extremely usefull to me. Can someone review this?
Comment #3
ahoeben commentedPatch works as advertised, but included needed cleanup. +1 for functionality
I moved the core functionality of the patch to flexinode.module, and rolled new patches for field_file.inc and field_image.inc. Image fields can now also set file save paths.
Attached tar contains three patches.
Comment #4
ahoeben commentedI'll be rolling new patches since my patches above are kind-off sort-off bogus. Must sleep more...
Comment #5
ahoeben commentedpatch 1 of 3
Patches flexinode.module with dgtlmoon's functionality. Adds '%userid' metapath element (user's uid). Usernames can e changed (by the user), at which time new directories would be created. I'm also not sure about special characters in the usernames. We'll probably have to add validation to the %username code.
Comment #6
ahoeben commentedpatch 1 of 3
And again I screw up... Please disregard the previous patch
Here's the good patch for flexinode.module.
Comment #7
ahoeben commentedpatch 2 of 3
Patches field_file to add the path directives. Also adds fields to optionally limit the filesize and extension (after upload).
Comment #8
ahoeben commentedpatch 3 of 3
Patches field_image to add the path directives.
Note: please apply all three patches.
Comment #9
igrcic commentedcan anyone please revert this for v 4.6 also ??
thank you so much
Comment #10
dgtlmoon commentedhavent used 4.6 :( sorry
has this been commited to HEAD branch?
Comment #11
Bèr Kessels commentedNot committed. There are more pressing issues in queue for file fields.
Comment #12
igrcic commentedthis is so much needed function! can anyone try to make path for 4.6.* ??? some directions maybe?? tnx
Comment #13
dgtlmoon commentedwhat errors do you get if you try to use it in 4.6?
Comment #14
Bèr Kessels commentedNote that I won't add new features on 4.6, 4.7 or any other stable branch. Also note that this feature is therefore marked for CVS.
Comment #15
dgtlmoon commentedWill this make it for 5.0? it is much needed
Comment #16
Bèr Kessels commentedplease give the patch another review, using the latest HEAD file fields.
Comment #17
ahoeben commentedAttached path is against 4.7.x 1.0, but needs some testing.
For file_field.inc, additional upload limitations were lifted from image_field.inc. A list of accepted extensions is a required option for the field, in order to increase security.
Comment #18
Bèr Kessels commentedLets keep the focus and not mix up features.
This issue thread is about Configurable file save path directives file_field.inc and image_field.inc
I created another thread to allow file-extension settigns, find it in http://drupal.org/node/113506
Comment #19
ahoeben commentedIn order to keep consistency between image and file uploading, implementing the two features became rather intertwined.