function file_get_content_headers

Same name in other branches
  1. 7.x includes/file.inc \file_get_content_headers()
  2. 9 core/modules/file/file.module \file_get_content_headers()
  3. 8.9.x core/modules/file/file.module \file_get_content_headers()
  4. 10 core/modules/file/file.module \file_get_content_headers()

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

Parameters

\Drupal\file\FileInterface $file: A file entity.

Return value

array An associative array of headers, as expected by \Symfony\Component\HttpFoundation\StreamedResponse.

Deprecated

in drupal:11.2.0 and is removed from drupal:12.0.0. Use Drupal\file\Entity\FileInterface::getDownloadHeaders() instead.

See also

https://www.drupal.org/node/3494172

File

core/modules/file/file.module, line 43

Code

function file_get_content_headers(FileInterface $file) {
    @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0.  Use Drupal\\file\\Entity\\FileInterface::getDownloadHeaders() instead. See https://www.drupal.org/node/3494172', E_USER_DEPRECATED);
    return $file->getDownloadHeaders();
}

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