do not list more than 20 folders/files

This commit is contained in:
Uwe Steinmann 2023-10-31 18:49:54 +01:00
parent 4e2af679e9
commit 7c1479708f

View File

@ -54,9 +54,12 @@ $('.folderselect').click(function(ev) {
$rii = new DirectoryIterator($path);
$files = array();
foreach ($rii as $file)
foreach ($rii as $file) {
if (!$file->isDir())
$files[] = [substr($file->getPath(), strlen($path)+1), $file->getFilename()];
if(count($files) > 20)
return $files;
}
return $files;
}
@ -68,11 +71,14 @@ $('.folderselect').click(function(ev) {
$rii = new DirectoryIterator($path);
$files = array();
foreach ($rii as $file)
foreach ($rii as $file) {
if ($file->isDir()) {
if(($t = substr($file->getPath(), strlen($path)+1)) && ($file->getFilename() == '.'))
$files[] = $t;
}
if(count($files) > 20)
return $files;
}
return $files;
}