You are here

function imce_file_download in IMCE 8

Same name and namespace in other branches
  1. 8.2 imce.module \imce_file_download()
  2. 5 imce.module \imce_file_download()
  3. 6.2 imce.module \imce_file_download()
  4. 6 imce.module \imce_file_download()
  5. 7 imce.module \imce_file_download()

Implements hook_file_download().

File

./imce.module, line 43
Defines Drupal hooks for imce module.

Code

function imce_file_download($uri) {
  if (Imce::accessFileUri($uri, \Drupal::currentUser())) {
    return [
      'Content-type' => \Drupal::service('file.mime_type.guesser')
        ->guess($uri),
      'Content-Length' => filesize($uri),
    ];
  }
}