Thanks for that. Unless it’s the way the forum presented it, I think you’d want to add some quotes in this line though, as otherwise it might cause problems when you present a filename that contains spaces.
echo "<option value=".$file.">$file</option>";
Perhaps
echo '<option value="' . $file . '">' . $file . '</option>';
using single quotes so you can put double-quotes inside the html without escaping it.