I am trying to do a different computation if the user has added a new file attachment to a node when they edited it -- so, for example, if they edit the node, but don't update the file, the computed value stays the same. If they edit the node and update the file attachments in some way (e.g. add a new file) then I want to recalculate the value of the computed field.

I've found out how to use

if ($node->is_new) {
   ...
}

and

if ($node->revision) {
  ...
}

so I'm wondering if there is a variable available to me that will tell me whether a file has been uploaded. I haven't been able to track down that information in my searching.

Thanks for any help or leads.

Comments

laryn’s picture

In case it's helpful to anyone else -- I saved the file id (fid) in a computed field and compared it with the current fid. If they are different, then I know the file has been changed.