function file_module_test_file_download

Implements hook_file_download().

File

modules/file/tests/file_module_test.module, line 74

Code

function file_module_test_file_download($uri) {
    if (variable_get('file_module_test_grant_download_access')) {
        // Mimic what file_get_content_headers() would do if we had a full $file
        // object to pass to it.
        return array(
            'Content-Type' => mime_header_encode(file_get_mimetype($uri)),
            'Content-Length' => filesize($uri),
            'Cache-Control' => 'private',
        );
    }
}

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