file_get_content_headers(FileInterface $file)
Examines a file entity and returns appropriate content headers for download.
\Drupal\file\FileInterface $file: A file entity.
array An associative array of headers, as expected by \Symfony\Component\HttpFoundation\StreamedResponse.
function file_get_content_headers(FileInterface $file) { $type = Unicode::mimeHeaderEncode($file->getMimeType()); return array( 'Content-Type' => $type, 'Content-Length' => $file->getSize(), 'Cache-Control' => 'private', ); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!file!file.module/function/file_get_content_headers/8.1.x