Question

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.?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top