if (!is_file($archivo)) { // nos fijamos si existe el archivo
echo "Error: el archivo $archivo no se encontró! (saliendo por razones de seguridad)";
exit;
}
// envio de cabeceras HTTP para el browser
$f = fopen($archivo, "rb");
$content_len = (int) filesize($archivo);
$content_file = fread($f, $content_len);
fclose($f);
$output_file = $archivo;
@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octetstream; name="' . $output_file . '"'); //This should work for IE & Opera
//header('Content-Type: application/octet-stream; name="' . $output_file . '"'); //This should work for the rest
header('Content-Disposition: inline; filename="' . $output_file . '"');
header("Content-length: $content_len");
echo $content_file;