Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/08/2009, 04:45
Avatar de humanista
humanista
 
Fecha de Ingreso: abril-2005
Mensajes: 878
Antigüedad: 19 años, 1 mes
Puntos: 15
Respuesta: Descarga segura de Manual

Hola, GavorV me has servido de gran ayuda.

En principio todo va bien pq me funciona pero por si hubiera algún problema, especialmente de seguridad, pego el código para q alguien me diga si hay errores:

<?php
// Define the path to file
$file = 'fichero.rar';

if(!file)

{
// File doesn't exist, output error
die('file not found');
}

else

{
// Set headers
$path = "../download621876/";
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=$file");

// Read the file from disk

readfile($path.$file);
}

?>


y por cierto, para q sirven estas cabeceras? las tengo q poner?, pq me funciona sin ellas...:

header("Content-Type: application/rar");
header("Content-Transfer-Encoding: binary");
header("Cache-Control: public");

gracias.