I can not list a directory in codeiniter, I just need the names of the files, before I did it like this:
setlocale(LC_ALL,"es_ES");
$path="servicios/"; //directorio a listar
$directorio=dir($path);
$pn= array();//pila de nombres
$pf= array();//pila de fechas
$pt= array();//pila de tamaNos
while ($archivo = $directorio->read()){
$archivo1="servicios/".$archivo;
if(file_exists($archivo1)){
if(($archivo!='index.php')&&($archivo!='.')&&($archivo!='..')){
array_push($pn, $archivo);
array_push($pf, date("d F Y H:i", filemtime($archivo1)));
array_push($pt, filesize($archivo1));
}
}
else
{
echo 'no existe' ;
//var_dump($archivo);
}
}
$directorio->close();
array_multisort($pn,SORT_DESC,$pf,$pt);
for($i=0; $i<count($pn); $i++){
echo "<a href='servicios/".$pn[$i]."'>".$pn[$i]."</a>";
setlocale(LC_ALL,"es_ES");
echo " <b>fecha:</b>".$pf[$i];
//echo '<a href="servicios/'.$pn[$i].'">'.$pn[$i]."</a><b>fecha:</b>".$pf[$i];
printf(" <b>peso:</b>%1.3fKb<br>\n",$pt[$i]/1000);
}
Then I tried the codeigniter function:
$map = directory_map('./mydirectory/');
to the directory it can be in the root and also in the same folder of the view to try but it always shows null