You are here

function imce_file_download in IMCE 7

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

Implements hook_file_download().

Support private downloads if not disabled.

File

./imce.module, line 129
Implements the necessary hooks for the file browser to work properly.

Code

function imce_file_download($uri) {
  $serve = file_uri_scheme($uri) == 'private' && !variable_get('imce_settings_disable_private', 1) && file_exists($uri) && strpos(basename($uri), '.');
  if ($serve) {
    return array(
      'Content-type' => file_get_mimetype($uri),
      'Content-Length' => filesize($uri),
    );
  }
}