2

Is there an API hook I could use to run some custom PHP code after a file is deleted? I need access to the name of the file which has just been deleted.

I attempted using hook_nodeapi, and testing for when the operation is delete, but it seems by this stage the file row has been removed from the database, and I'm left with just information about the node itself.

I'm using Drupal 6. (I see that Drupal 7 does have a hook: hook_file_delete)

1 Answer 1

2

I believe you can use FileField; this module is now part of Drupal 7 core, and provides additions to the API, such as hook_file_delete().

1
  • Cheers, I'm already using that module, wasn't aware of the extra hook
    – Stuart
    May 16, 2012 at 11:06

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.