I tried to use [file:size] and could not find documentation showing how to use it. I posted here because there are a few similar tokens that have no documentation and do not work in any of my experiments. I will describe what I am trying to do then ask some questions. I can write an add-on module if that is needed.

I am creating a node with one file attached. I need file size and some other attributes as fields in the node. After the file field, I added a file size field as a text field and inserted the token [file:size]. The field now contains the string [file:size] instead of the file size. How can you use [file:size]?

Is there another way to insert the file size?

When I have file size working, I need some other attributes that are listed as available in tokens but the tokens do not work when used as a single value in a text field. If the tokens of this type are not meant to be used direct in fields, I can write a module to do something else. What would be the best approach?

I am thinking in Drupal 6 terms here. The actual project is based on Drupal 7. If [file:size] and similar tokens are available at the node insert or update stage, I can write code to populate some fields. When are the tokens available in the Drupal 7 processing? At what point should I hook in my code?

Comments

dave reid’s picture

Status: Active » Closed (duplicate)

You need to access the tokens for a file attached to the node's field, so you need part 2 of #691078: Field tokens. Eventually you'd use a token like [node:field_file:first:size].