function hook_file_presave
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
Related topics
1 function implements hook_file_presave()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- entity_crud_hook_test_file_presave in modules/
simpletest/ tests/ entity_crud_hook_test.module - Implements hook_file_presave().
1 invocation of hook_file_presave()
File
-
modules/
system/ system.api.php, line 2887
Code
function hook_file_presave($file) {
// Change the file timestamp to an hour prior.
$file->timestamp -= 3600;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.