1
Guys need to limit the amount of files that will be displayed in a certain directory.
This is my php code that lists the files in my directory :
<?php
$diretorio = getcwd(). "/arquivos" ;
$ponteiro = opendir($diretorio);
while ($nome_itens = readdir($ponteiro))
$itens[] = $nome_itens;
sort ($itens);
foreach ( $itens as $listar )
if ( $listar!="." && $listar!="..")
print '.$listar.';
?>
Is there any way to increment this code so that it displays only the last 5 files sent to this directory ?
Vlw Anderson is that code anyway, now help me to just display the file name. Ex: With this code it displays: files/doc.txt I need it to display: doc.txt Thanks in advance.
– Aurélio Castro
Just use the function
explode
using the character/
as delimiter and get the last position of the array. Or rather, use the functionpathinfo
.– Woss