Jump to content
xisto Community
Sign in to follow this  
nickmealey

Directory Function - I need some help

Recommended Posts

Hey, I'm really in a jam. Here's whats happening, I have to post over 350 streaming WMA files on a server. But it would be nice to not have to script it out in HTML. And I know that in PHP you can set a directory or folder and PHP will place all the files out there. Would somone show me a way to do that? and please note where I must insert filenames, folder, ect.... So, I have tons of files that I need to have on the page, but scrpiting it takes long.
Heres the page I'm working on: http://forums.xisto.com/no_longer_exists/
thanx so much

Share this post


Link to post
Share on other sites

Here's a little script that'll read the contents of the directory. Unfortunately, I can't figure out how it sorts, but that may just be a problem with my school's server:

$dir1 = "**DIR**"; //replace **DIR** with the directory where the stuff is$dir = opendir($dir1); //open directory        while(false !== ($file1 = readdir($dir))) //as long as there are more files        {                if($file1 != "." && $file1 != "..") //so that it doesn't get parent directory and current directory.                {                        $file = "$dir1/$file1"; //the file path                        echo "<a href=\"$file\">$file1</a><br />"; //print link to file                } //endif        } //endwhile

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.