1 system.api.php hook_file_delete(File $file)

Respond to file deletion.

This hook is invoked after the file has been removed from the filesystem and after its records have been removed from the database.

Parameters

File $file: The file that has just been deleted.

See also

hook_file_predelete()

FileStorageController::delete()

Related topics

File

core/modules/system/system.api.php, line 2423
Hooks provided by Backdrop core and the System module.

Code

function hook_file_delete(File $file) {
  // Delete all information associated with the file.
  db_delete('upload')->condition('fid', $file->fid)->execute();
}