function file_get_content_headers

Same name and namespace in other branches
  1. 9 core/modules/file/file.module \file_get_content_headers()
  2. 8.9.x core/modules/file/file.module \file_get_content_headers()
  3. 10 core/modules/file/file.module \file_get_content_headers()
  4. 11.x core/modules/file/file.module \file_get_content_headers()

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

Parameters

$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 modules/file/file.module
Implements hook_file_download().

File

includes/file.inc, line 2732

Code

function file_get_content_headers($file) {
    $type = mime_header_encode($file->filemime);
    return array(
        'Content-Type' => $type,
        'Content-Length' => $file->filesize,
        'Cache-Control' => 'private',
    );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.