PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
tristanlee85
Forum Contributor
Posts: 172 Joined: Fri Dec 19, 2003 7:28 am
Post
by tristanlee85 » Sat Dec 27, 2003 1:16 am
Code: Select all
<?php
$folder = "\\saturnspot";
$link = 'http://24.197.74.135/saturnspot';
if ($handle = opendir($folder)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "<a href="http://24.197.74.135/saturnspot/$file">$file</a><br><br>";
}
}
closedir($handle);
}
?>
With this, it shows all files and folder in the folder specified. How do I display only files and hide the folders?
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Sat Dec 27, 2003 2:00 am
Code: Select all
//....[skipped]....
if ($file != "." && $file != ".." && !is_dir($folder.$file)) {
//....[skipped]....