![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
19/08/2009, 04:45
|
![Avatar de humanista](http://static.forosdelweb.com/customavatars/avatar97313_3.gif) | | | Fecha de Ingreso: abril-2005
Mensajes: 878
Antigüedad: 19 años, 9 meses 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. |