Code: Select all
?php
// declare the folder
$ourDir = "/miaCartella";
// prepare to read directory contents
$ourDirList = @opendir($ourDir);
// loop through the items
while ($ourItem = readdir($ourDirList))
{
// check if it is a directory
if (is_dir($ourItem))
{
echo "directory: $ourItem <br />";
}
// check to see if it is a file
if (is_file($ourItem))
{
echo "file: $ourItem <br />";
}
}
closedir($ourDirList);
?>
Warning: readdir() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP\www\recuperarelistafolderefile.php on line 19
Warning: closedir() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP\www\recuperarelistafolderefile.php on line 47