Definition

file_download()
drupal/includes/file.inc, line 485

Description

Call modules to find out if a file is accessible for a given user.

Related topics

Namesort iconDescription
File interfaceCommon file handling functions.

Code

function file_download() {
  $file = $_GET['file'];
  if (file_exists(file_create_path($file))) {
    $list = module_list();
    foreach ($list as $module) {
      $headers = module_invoke($module, 'file_download', $file);
      if ($headers === -1) {
        drupal_access_denied();
      }
      elseif (is_array($headers)) {
        file_transfer($file, $headers);
      }
    }
  }
  drupal_not_found();
}