Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/12/2015, 09:55
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 11 meses
Puntos: 263
Respuesta: Forzar descarga archivo pdf con otro nombre

en esta linea estas colocando que el nombre del archivo sea la ruta:

Cita:
header("Content-Disposition: attachment; filename='$ruta'");
cambia esto asi:

Código PHP:
Ver original
  1. $ruta="../files/pdf/curso1/123456.pdf";
  2. $nombre = "Nombre.pdf";
  3. $len = filesize($ruta);
  4. header('Content-type: application/pdf');
  5. header("Content-Disposition: attachment; filename='$nombre'");
  6. header('Content-Length: '.$len);
  7. readfile($ruta);
__________________
[email protected]
HITCEL