Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By W.M. on
I want to ask is this possible?! Is it possible to choose a custom upload path for files for each node in edit page?! I know that there are modules that allow automatic generation of upload paths by tokens but I am looking for a method that allows choosing custom paths upon file upload and node creation.
Comments
Sure, install CCK, FILEFIELD
Sure, install CCK, FILEFIELD + ImageField then enable both modules, create a new content type, and add the image field. This will then allow you to select where you would like to upload the image. However this path is where all images are uploaded to from the content type.
+1. I am looking for that
+1. I am looking for that too.
It will be very usefull for people creating websites with a big amount of files. If there is a custom categorization I don't see how classic way like tokens works out.
For example I have the following structure on my site:
-- taxonomy/menu term level 1
-------- taxonomy/menu temr level 2
--------------- custom content type with container role (lets call it A) (level 3)
------------------------custom content type with file attachments(lets call it B) (level 4)
I have the corresponding filesystem on my server. The asked is :
When someone creates a B to be stored in the proper A folder.
The only way around I have come up with is to:
make all the A nodes of level 3 taxonomy terms(which are about 150 ... ! ). And then follow this guide:
http://www.deciphered.net/blog/2009/07/09/howto_custom_paths_taxonomy_te...
However completely custom upload path would be very usefull in many cases...
Have you check out Filefield
Have you check out Filefield Paths? http://drupal.org/project/filefield_paths
This allows you to control the upload path with many different token options, change the filenames, convert to lowercase, etc. I consider it a must on any site allowing uploads as it helps organize things and helps you rename files to keep things consistent.
EDIT: D'oh! Just reread your question and saw that you said you've seen modules like that. sorry!
Although would creating CCK fields just to be used for the tokens, and hiding their output work?
I am sorry but I am not
I am sorry but I am not familiar enough with tokens usage and I don't get exactly what do you mean, but it seems a good idea, can you explain more ? :)
Do you mean sth like this http://drupal.org/node/483156 ? Or by some way create a cck field , e.g :
1) text field to contain folder directory? or
2) node reference field , so that to grub node title (the level 3) and find the corresponding directory ?
You can use a particular
You can use a particular module called token_custom to create custom tokens. You will be able to create those tokens by specifying custom php codes that, for example, take node id as input and generate based on it desired values to be used then as upload paths (there is a module for that - cannot remember name).
You can generate several custom tokens and then build the desired upload path pattern:
[token one]/[token two]/[token three]
Please note: no need to use CCK
Best wishes!
You need these
You need these modules:
Upload path
Token Custom
Now you have the accurate names :-)