I am trying to use this token pattern [type]/[nid] for image uploads.

For example:
Images uploaded to a 'slideshow' content-type would be placed in ".../files/slideshow/44/name_of_image.jpg" but they are placed in .../files/[type]/[nid]/name_of_image.jpg". The 2 tokens are not being replaced.

One issue with any node related tokens is that certain information like nid, title, etc.. would only be available after the node was created. I thought this might be my issue, so I tried to upload files after a node was created and I was still seeing the same problem.

I am not 100% what the best solution is. Maybe for node specific file paths one would have to hide the file upload for new content and display it after the node was created.

Anyway, I think this is great idea. My goal is to have users upload files to a node specific directory and then restrict the node's html editor to only browse files from this directory.

Comments

deciphered’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

As you mentioned, Node Tokens are not populated until the node is created, and the way this module works is that it uploads the files to the path defined in the pattern (files/[type]/[nid]), then when the node is saved it processes the tokens and moves the files to the correct path (files/slideshow/44).

I tested your above settings on a clear install of D6 and it worked perfectly.

Any information you can provide me with so that I can replicate the issue would be helpful:
What modules/versions do you have installed/enabled?
What is the machine readable name of the imagefield you created?
... Anything else that you can possibly think of that may be relevant.

Hopefully I can help you out and get this working for you.

jrockowitz’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I really wanted to get this work and was so completely thrown off by the '[type]/[nid]' folder that I never submitted the form. As soon as I submitted the form, the file path was fixed. Thanks so much for taking the time out to look at this issue.

One final thought is... if a new node needs to create temp folder for filefield path's 'node tokens' then maybe all these 'temp' folders should be placed in a temp directory.

stephen ollman’s picture

Issue summary: View changes

Is [node:title] meant to also work with this module?

I'm not having any luck with this token.