hook_file_insert
function hook_file_insert
hook_file_insert($file)
Respond to a file being added.
This hook is called after 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 been added.
See also
Related topics
File
- modules/system/system.api.php, line 2888
- Hooks provided by Drupal core and the System module.
Code
function hook_file_insert($file) { // Add a message to the log, if the file is a jpg $validate = file_validate_extensions($file, 'jpg'); if (empty($validate)) { watchdog('file', 'A jpg has been added.'); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_file_insert/7.x