function hook_file_download_access

cis7 file.api.php hook_file_download_access($file_item, $entity_type, $entity)
cle7 file.api.php hook_file_download_access($file_item, $entity_type, $entity)
elmsmedia7 file.api.php hook_file_download_access($file_item, $entity_type, $entity)
icor7 file.api.php hook_file_download_access($file_item, $entity_type, $entity)
meedjum_blog7 file.api.php hook_file_download_access($file_item, $entity_type, $entity)
mooc7 file.api.php hook_file_download_access($file_item, $entity_type, $entity)

Control download access to files.

The hook is typically implemented to limit access based on the entity the file is referenced, e.g., only users with access to a node should be allowed to download files attached to that node.


array $file_item: The array of information about the file to check access for.

$entity_type: The type of $entity; for example, 'node' or 'user'.

$entity: The $entity to which $file is referenced.

Return value

TRUE is access should be allowed by this entity or FALSE if denied. Note that denial may be overridden by another entity controller, making this grant permissive rather than restrictive.

See also


4 functions implement hook_file_download_access()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

comment_file_download_access in modules/comment/comment.module
Implements hook_file_download_access().
entity_file_download_access in sites/all/modules/ulmus/entity/entity.module
Implements hook_file_download_access() for entity types provided by the CRUD API.
node_file_download_access in modules/node/node.module
Implements hook_file_download_access().
user_file_download_access in modules/user/user.module
Implements hook_file_download_access().
1 invocation of hook_file_download_access()
file_file_download in modules/file/file.module
Implements hook_file_download().


modules/file/file.api.php, line 29
Hooks for file module.


function hook_file_download_access($file_item, $entity_type, $entity) {
  if ($entity_type == 'node') {
    return node_access('view', $entity);



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.