function file_entity_file_download

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 file_entity.module file_entity_file_download($uri)
cle7 file_entity.module file_entity_file_download($uri)
elmsmedia7 file_entity.module file_entity_file_download($uri)
icor7 file_entity.module file_entity_file_download($uri)
meedjum_blog7 file_entity.module file_entity_file_download($uri)
mooc7 file_entity.module file_entity_file_download($uri)

Implements hook_file_download().

Related topics

File

sites/all/modules/ulmus/file_entity/file_entity.module, line 1926
Extends Drupal file entities to be fieldable and viewable.

Code

function file_entity_file_download($uri) {
  // Load the file from the URI.
  $file = file_uri_to_object($uri);

  // An existing file wasn't found, so we don't control access.
  // E.g. image derivatives will fall here.
  if (empty($file->fid)) {
    return NULL;
  }

  // Allow the user to download the file if they have appropriate permissions.
  if (file_entity_access('view', $file)) {
    return file_get_content_headers($file);
  }

  return NULL;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.