Skip navigation
Help

hook_file_presave

7 system.api.php hook_file_presave($file)

Act on a file being inserted or updated.

This hook is called when a file has been added to the database. The hook doesn't distinguish between files created as a result of a copy or those created by an upload.

Parameters

$file: The file that has just been created.

See also

file_save()

Related topics

1 function implements hook_file_presave()

1 invocation of hook_file_presave()

File

drupal/modules/system/system.api.php, line 2597
Hooks provided by Drupal core and the System module.

Code

function hook_file_presave($file) {
  // Change the file timestamp to an hour prior.
  $file->timestamp -= 3600;
}