You are here

function private_files_download_permission_download_headers in Private files download permission 7.2

Returns a proper array to be used for downloads.

1 call to private_files_download_permission_download_headers()
private_files_download_permission_file_download in ./private_files_download_permission.module
Implements hook_file_download().

File

./private_files_download_permission.module, line 596
Handles both module settings and its behaviour.

Code

function private_files_download_permission_download_headers($uri) {
  $attachment_mode = variable_get('private_files_download_permission_attachment_mode', FALSE);

  //
  if ($attachment_mode) {
    return array(
      'Content-Type' => file_get_mimetype($uri),
      'Content-Disposition' => 'attachment; filename=' . drupal_basename($uri),
    );
  }
  else {
    return array(
      'Content-Type' => file_get_mimetype($uri),
      'Content-Disposition' => 'inline',
    );
  }
}