Sh4d03
public text v1 · immutable <select name="service" class="body">
<option>--Select from List--</option>
<?php
$path = "/home/allstate/public_html/client"; // <-- Path to the location of files
function getFiles($path)
{
// Try to open the directory
if($dir = opendir($path))
{
// Create an array for all files found
$tmp = Array();
// Add the files
while($file = readdir($dir))
{
// Make sure the file exists
if($file != "." && $file != ".." && $file[0] != '.')
{
// If it's a directiry, list all files within it
if(is_dir($path . "/" . $file))
{
$tmp2 = getFiles($path . "/" . $file);
if(is_array($tmp2))
{
$tmp = array_merge($tmp, $tmp2);
}
}
else
{
array_push($tmp, $path . "/" . $file);
}
}
}
}
// Finish off the function
closedir($dir);
}
for ($i = 0 ; $i < count($tmp) ; $i += 1)
{
if (is_dir($tmp[i]))
{
if ($tmp[i] != "." && $tmp[i] != "..")
{
print ("<option>'Client ' ". $tmp[i]."</option>");
}
}
else
{
print ("<option>'-- ' ". $tmp[i]."</option>");
}
}
print(getFiles($path));