function file_download_headers in Drupal 6
Same name and namespace in other branches
- 7 includes/file.inc \file_download_headers()
Retrieves headers for a private file download.
Calls all module implementations of hook_file_download() to retrieve headers for files by the module that originally provided the file. The presence of returned headers indicates the current user has access to the file.
Parameters
$filepath: The path for the file whose headers should be retrieved.
Return value
If access is allowed, headers for the file, suitable for passing to file_transfer(). If access is not allowed, an empty array will be returned.
See also
hook_file_downlaod()
Related topics
2 calls to file_download_headers()
- file_download in includes/
file.inc - Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
- file_download_access in includes/
file.inc - Checks that the current user has access to a particular file.
File
- includes/
file.inc, line 1006 - API for handling file uploads and server file management.
Code
function file_download_headers($filepath) {
$headers = module_invoke_all('file_download', $filepath);
if (in_array(-1, $headers)) {
// Throw away the headers received so far.
$headers = array();
}
return $headers;
}