I have a Drupal 7 site with a custom node type with a custom attachment field. After a (kind of this custom) node has been published, I got an e-mail with the help of Rules module. I would like to set up an another rule, which sends me an another e-mail, when somebody edits this node and uploads an attachment. Inside the mail, I want to see the full url to the uploaded file.

After a several test, I'm not able to insert the full path to the uploaded file. The [node:field-attachment:file] doesn't work at all. I'm able to insert (manually) the url where this file resides, but after I can not insert the file name (so even the filename would be enough for me).

So with the [node:field-attachment:file] I got an error: *Fatal error: Call to a member function value() on a non-object in /home/xxx/sites/all/modules/entity/entity_token.tokens.inc on line 297.*

Which is exactly this:

 * Gets the token replacement by correctly obeying the options.
function _entity_token_get_token($wrapper, $options) {

   if ($wrapper->value() === NULL) {
// Do not provide a replacement if there is no value.
return NULL;

With the [node:field-attachment], I'm getting the e-mail, but it contains this: You can download the file from here: Property 0

Which token should I use to get the url (or the filename) of the actually uploaded file when I edit the node?

  • Hey Pene, is this node:field-attachment-field a multi value field, or do you only allow a single value for it? I bet it is a multi value field ... If I'm right, then yes of course Drupal (Entity API?) works as implemented ... and there is an extremely easy solution for this. Curious for your reply to this comment ... While waiting: the bets are open! Commented Nov 24, 2016 at 18:21
  • 1
    However I've solved this problem some years ago, it can be useful for others. Feel free to post your solution. To answer your question: yes, this was a multi value attachment field.
    – Pene
    Commented Dec 3, 2016 at 22:31

1 Answer 1


You can use these to get file name and file url respectively (Drupal 7.67 Entity API 1.9):


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.