|
-
Sep 22nd, 2001, 07:38 PM
#1
Thread Starter
Fanatic Member
PHP - Directory Listing
Could someone please give me an example, or point me to a place that has an example of how to do this?
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 22nd, 2001, 07:48 PM
#2
Code:
<?php
if ($dir = @opendir("/path/to/dir")) {
while ($file = readdir($dir)) {
echo "$file<BR>\n";
}
closedir($dir);
}
?>
-
Sep 22nd, 2001, 08:08 PM
#3
Thread Starter
Fanatic Member
Hmm. I get a parse error on line 5.
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 22nd, 2001, 08:08 PM
#4
Thread Starter
Fanatic Member
Never mind, I fixed it. Thanks!
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 22nd, 2001, 08:12 PM
#5
Thread Starter
Fanatic Member
One more thing: The first two files are "." and ".." Is there a way I can exclude these?
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 22nd, 2001, 08:17 PM
#6
Code:
<?php
if ($dir = @opendir("/path/to/dir")) {
while ($file = readdir($dir)) {
if($file != "." && $file != ".."){
echo "$file<BR>\n";
}
}
closedir($dir);
}
?>
-
Sep 22nd, 2001, 08:18 PM
#7
Thread Starter
Fanatic Member
Alcohol & calculus don't mix.
Never drink & derive.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|