You are here

function file_resup_file_presave in File Resumable Upload 8

Same name and namespace in other branches
  1. 7 file_resup.module \file_resup_file_presave()

Implements hook_file_presave().

File

./file_resup.module, line 376

Code

function file_resup_file_presave($file) {

  // On 32bit platforms, filesize() may return unexpected results for files
  // larger than 2 GB and make drupal_write_record() crash.
  if (isset($file->file_resup_filesize)) {
    $file->filesize = $file->file_resup_filesize;
  }
  elseif (isset($file->original) && $file->original->filesize > PHP_INT_MAX) {

    // @todo We should not rely on $file->original because file might have been
    // replaced, but could not figure out a better solution so far...
    $file->filesize = $file->original->filesize;
  }
}