Path: C:\
<?php
function retorna_extensao($arq){ // função q pega a extensão do arquivo
$arr = explode('.', $arq);
$num = count($arr)-1;
$ext = $arr[$num];
return $ext;
}
$ext = retorna_extensao($nomearq);
if ($ext=="pdf"){header('Content-type: application/pdf');
header("Content-disposition: attachment; filename='../Download_Controlado/".$nomearq."'");
$bool=readfile($nomearq);if(!$bool){echo"ERRO: Tente novamente";}else{echo"baixado";}
}
else{header('Location: http://localhost/Download_Controlado/'.$nomearq);}
?>