0

I'm writing a Rule that sends an email when a user uploads a file to a node. How would I output the file's URL and filename in the body of the email?

First, some things to note:

  1. This is an Entityform node
  2. The File Upload field is a mulit-value field
  3. Drupal 7 site

In rules, when I use the replacemement token for the File Upload field...

[entityform:field-file-upload]

...it returns...

property 0, property 1, property 2

There are three files uploaded to this Entityform node, so it appears that Drupal is accurately reporting the correct number of files. But this is all the info I've been able to can extract.

I've tried to change the token in few different way, like these:


[entityform:field-file-upload:file:url]

[entityform:field-file-upload:0:file:url]

[entityform:field-file-upload:url]

[entityform:field-file-upload:0:url]

These all return nothing. What is the corrent token string to return URL, filename, etc.?

1 Answer 1

0

Through some trial and error and some further digging, I figured it out. Here's what works:

URL: [entityform:field-file-upload:0:file:url]

Filename: [entityform:field-file-upload:0:file:name]

Upload date: [entityform:field-file-upload:0:file:timestamp:short]

Increment the 0 to return more files from the multi-value array of uploaded files.

Once I had the basic syntax, the Drupal List of Tokens page was particularly useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.