Skip to content

Instantly share code, notes, and snippets.

@erlangparasu
Created February 21, 2017 09:10
Show Gist options
  • Save erlangparasu/76e2f8c6c2d1544c95e9afa246e52f86 to your computer and use it in GitHub Desktop.
Save erlangparasu/76e2f8c6c2d1544c95e9afa246e52f86 to your computer and use it in GitHub Desktop.
$fio = finfo_open(FILEINFO_MIME_TYPE);
$fif = finfo_file($fio, $path);
$ct = $fif;
$fio = finfo_open(FILEINFO_MIME_ENCODING);
$fif = finfo_file($fio, $path);
$cte = $fif;
//$fn = basename($path);
header('content-type:' . $ct);
header('content-transfer-encoding:' . $cte);
header('content-disposition:attachment;filename=' . $fn);
readfile($path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment