function hook_file_presave

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_file_presave($file)
cle7 system.api.php hook_file_presave($file)
elmsmedia7 system.api.php hook_file_presave($file)
icor7 system.api.php hook_file_presave($file)
meedjum_blog7 system.api.php hook_file_presave($file)
mooc7 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

4 functions implement 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().
filefield_paths_file_presave in sites/all/modules/ulmus/filefield_paths/filefield_paths.module
Implements hook_file_presave().
file_entity_file_presave in sites/all/modules/ulmus/file_entity/file_entity.file.inc
Implements hook_file_presave().
transliteration_file_presave in sites/all/modules/ulmus/transliteration/transliteration.module
Implements hook_file_presave().
1 invocation of hook_file_presave()
file_save in includes/file.inc
Saves a file object to the database.

File

modules/system/system.api.php, line 2801
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;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.