1 file.file.inc file_file_presave($file)

Implements hook_file_presave().

File

core/modules/file/file.file.inc, line 10
File hooks implemented by the Fil module.

Code

function file_file_presave($file) {
  // Always ensure the filemime property is current.
  if (!empty($file->original) || empty($file->filemime)) {
    $file->filemime = file_get_mimetype($file->uri);
  }

  field_attach_presave('file', $file);

  // Fetch image dimensions.
  file_metadata_fetch_image_dimensions($file);
}