// Create a list of files or folders and store them in an array
function makefilelist($folder, $filter, $sort=true, $type="files") {
$res = array();
$filter = explode("|", $filter);
$temp = opendir($folder);
while ($file = readdir($temp)) {
if ($type == "files" && !in_array($file, $filter)) {
if (!is_dir($folder.$file)) $res[] = $file;
} elseif ($type == "folders" && !in_array($file, $filter)) {
if (is_dir($folder.$file)) $res[] = $file;
}
}
closedir($temp);
if ($sort) sort($res);
return $res;
}
<?php
makefilelist ("downloads/");
$files = $res;
Category Forum
General DiscussionLabels
None yet
Statistics
3 participants
Notifications
You are not receiving notifications from this thread.
Related Questions