file_get_content_headers
function file_get_content_headers
file_get_content_headers($file)
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
File
- includes/file.inc, line 2553
- API for handling file uploads and server file management.
Code
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', ); }
© 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/includes!file.inc/function/file_get_content_headers/7.x