File: /home/asjudine/www/avigilajudicial/descargar_archivos_tickets.php
<?php
header("Content-type:application/pdf");
require_once("../Conectarse_.php");
global $dbi;
/*$result = mysql_query('SELECT id, nombre, contenido, tipo, ruta_archivo FROM tickets WHERE id= "'.$_GET["id"].'" ');*/
$result = mysql_query('SELECT id, nombre, contenido, tipo, ruta_archivo FROM tickets WHERE cedula = "'.$_GET["cedula"].'" and ticket = "'.$_GET["ticket"].'" and id = "'.$_GET["id"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
list($id, $nombre, $contenido, $tipo, $ruta_archivo)=mysql_fetch_row($result);
$id = $id;
$nombre = $nombre;
$contenido = $contenido;
$tipo = $tipo;
$ruta_archivo = $ruta_archivo;
echo $ruta_archivo;
//header("Content-type: application/force-download");
//header("Content-type: application/pdf");
//header('Content-Disposition: attachment; filename='.$nombre);
//header('Content-Transfer-Encoding: binary');
//header('Content-Length: '.filesize($ruta_archivo));
//readfile($ruta_archivo);
}
//Example Test - Not Working
/*
// Direct Download
header("Content-type: application/force-download");
$archivo="https://www.boe.es/buscar/pdf/2013/BOE-A-2013-12886-consolidado.pdf";
header("Content-Length: " . filesize ($archivo) );
header("Content-type: application/pdf");
header("Content-disposition: attachment; filename=".basename($archivo));
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
$filepath = readfile($archivo);
*/
/*
//Show Browser
$archivo="https://www.boe.es/buscar/pdf/2013/BOE-A-2013-12886-consolidado.pdf";
header("Content-Length: " . filesize ($archivo) );
header("Content-type: application/pdf");
header("Content-disposition: inline;
filename=".basename($archivo));
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
$filepath = readfile($archivo);*/
header("Content-type: application/force-download");
$archivo=$ruta_archivo;
header("Content-Length: " . filesize ($archivo) );
header("Content-type: application/pdf");
header("Content-disposition: inline;
filename=".basename($archivo));
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
$filepath = readfile($archivo);
?>