http://php.net/manual/en/function.readfile.php
?>Codice PHP:
<?php
$cartella_dove_si_trova_il_file = "cartella/";
$nomefile="sviluppo.xls";
if (file_exists($cartella_dove_si_trova_il_file . $nomefile)) {
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel"');
header('Content-Disposition: inline; filename='.basename($nomefile));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($cartella_dove_si_trova_il_file . $nomefile));
ob_clean();
flush();
readfile($cartella_dove_si_trova_il_file . $nomefile);
}
else{
echo 'file non esistente';
}