I'm doing a download manager in PHP, through which a user can download a file.
What I intend is the following Instead of passing the direct route to the file (www.dominio.com/ftp/archivo.rar) pass it, www.dominio.com/descarga.php?id=3 this in the download manager when you click on properties to see where it is downloaded, you will only see www.dominio.com/descarga.php?id=3 and not the absolute path to the file.
What interests me is to hide the download path or create a temporary route
thanks in advance.
Looking for a solution I found this one that is very easy but I can not implement it 100%
<?php
switch($id) {
case '':
header ("Location: http://Mi-pagina.com"); // esta sera la pagina que aparecera al abrir el archivo por defecto
break;
case 'descarga1': // Este sera el nombre que le pondremos al id del archivo
header ("Location: ./archivos/descarga1.zip"); // esta es la ruta del nombre del archivo a descargar
break;
default:
header ("Location: http://Mi-pagina.com"); // esto al igual que el primero es el header por default que aparecera al acceder al archivo directamente osea redirigira para alla si quieren accesar al archivo directamente desde el navegador
} ?>
The first time it worked well but in other tests it does not download the file in question and I have no idea what part of the code is wrong.