Here is a tidbit for you... a quick fix that doesnt require php at all
Simply exclude an index file from the directory. Enable your server to render directories instead of failure to find/access default pages.
Voila. Same effect.
You have limited customizability depending on your access to the server configuration files
======
If you want to be able to download, upload, change files, etc on the servers directories via the internet, as well as have a full list of files, etc... written in php... and with limited customization...
Then http://www.webfilebrowser.org/ has an excellent program for free download that I use. I have a slightly tweaked version though that I much prefer. If you want my version, let me know. It looks better but hasnt been cleared by the original program as "safe", which is just a formality since I know exactly what I changed.