Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/07/2007, 14:51
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años, 9 meses
Puntos: 2135
Re: permitir descargar un archivo

Puedes usar este codigo:
Código PHP:
$archivonombre "imagen.jpg";
$archivo "/path/al/archivo.jpg";

if( 
file_exists$archivo ) ) {
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=$archivonombre");
header("Content-Transfer-Encoding: binary");
header("Cache-Control: private");

@
readfile$archivo );
} else {
    die(
"No se encontro el archivo.");