You are here

function file_aliases_file_download in File Aliases 7

Same name and namespace in other branches
  1. 6 file_aliases.module \file_aliases_file_download()

Implements hook_file_download().

Parameters

$uri:

Return value

array

File

./file_aliases.module, line 166
Contains core functions for the File Aliases module.

Code

function file_aliases_file_download($uri) {
  $file = drupal_realpath($uri);
  $file_alias = drupal_get_path_alias($_GET['q']);
  $fileinfo = pathinfo($file_alias);
  return array(
    'Cache-Control' => 'public',
    'Content-Disposition' => "filename='{$fileinfo['basename']}'",
    'Content-Length' => filesize($file),
    'Content-Type' => mime_content_type($file),
  );
}