PDA

View Full Version : Display everything in a directory.


OrangeDemon
03-23-2008, 12:35 AM
So I'm experimenting around with an upload script, it's pretty basic, but you can upload files to a server, and my webpage is here: http://shockwave.987mb.com/index.html

anyway. The files get uploaded to the directory
http://shockwave.987mb.com/upload/

and I want all the files to be public.
I've browsed all over the net and couldn't find anything, except you need php to display it. So I guess anything would go for an index, but how would I make it so that the index displays everything in it's current directory. It doesn't need to be fancy.

I'm a pretty noobish coder and this upload site is just an experiment and a means of hosting images for other forums I belong to.

Could anybody help?
Thanks in advance!

erikh06
03-23-2008, 12:38 AM
<?php
$dir_to_load = "/home/public_html/directory/x/y";
$mydir = opendir($dir_to_load);

while($filename = readdir($mydir)) {
echo "$filename<br />\n";
}
closedir($mydir);
?>