I am trying to import an excel book in PHP but the name of this file is changed every day.
$nombreArchivo="/Carpeta/archivovariable.xlsx"
Is there any code to add in the path such as "%%" or "*" so that the file is imported without importing the name?
I appreciate your help, I found the solution and here I leave it. This code reads all the files within a directory and gets its name and extension:
<?php
$directorio = opendir("."); //ruta actual
while ($archivo = readdir($directorio)) //obtenemos un archivo y luego otro sucesivamente
{
if (is_dir($archivo))//verificamos si es o no un directorio
{
//Aqui hacen algo si no es un directorio
}
else
{
echo $archivo . "<br />"; //Aqui hacen lo que quieran con cada archivo
}
}
?>
Source: link