You are here

function elfinder_file_download in elFinder file manager 6.2

Same name and namespace in other branches
  1. 8.2 elfinder.module \elfinder_file_download()
  2. 7.3 elfinder.module \elfinder_file_download()
  3. 7.2 elfinder.module \elfinder_file_download()

File

./elfinder.module, line 1183

Code

function elfinder_file_download($uri) {
  if (variable_get('elfinder_settings_filesystem_handleprivate', 'true') == 'true') {
    global $user;
    $accessown = 'download own uploaded files';
    $accessall = 'download all uploaded files';
    $info = elfinder_get_drupal_file_obj($path);
    if ($info->uid == $user->uid && user_access($accessown) || user_access($accessall)) {
      $disposition = preg_match("/^(text|image)\\//", $info->filemime) ? 'inline' : 'attachment';

      //return file_get_content_headers($info);
      return array(
        'Content-Type' => $info->filemime,
        'Content-Length' => $info->filesize,
      );

      //return array('Content-Type' => $info->filemime);
    }
    return -1;
  }
}