function file_get_content_headers

7.x file_get_content_headers($file)

Examines a file object and returns appropriate content headers for download.


$file: A file object.

Return value

An associative array of headers, as expected by file_transfer().

Related topics

1 call to file_get_content_headers()
file_file_download in drupal/modules/file/file.module
Implements hook_file_download().


drupal/includes/, line 2476
API for handling file uploads and server file management.


function file_get_content_headers($file) {
  $name = mime_header_encode($file->filename);
  $type = mime_header_encode($file->filemime);

  return array(
    'Content-Type' => $type,
    'Content-Length' => $file->filesize,
    'Cache-Control' => 'private',