...

View Full Version : question about directory listing.



kornmusic420
12-07-2008, 04:24 AM
hi i need help with how to make my websites directorys show up like a directory listing. where it will display all the files in that directory. im completly new to php and this stuff if anyone could help that would be grate thanks.

rangana
12-07-2008, 04:53 AM
Might help:
http://www.spoono.com/php/tutorials/tutorial.php?id=10
http://www.liamdelahunty.com/tips/php_list_a_directory.php

kornmusic420
12-07-2008, 06:53 AM
ok i followed the code and now im wondering how i apply it to the directorys. like if im just supposed to add it to the index.php or something like that or what? im sorry but i am completly lost on this stuff. i have no experience.

toxictoad
12-08-2008, 02:00 AM
I've recently added this to my site to show all the files in the uploads directory.


<?php
$dir = "http://mysite.com/files/uploads/"; // Name of the directory you want to view using the script

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "/n";
}
closedir($dh);
}
}

if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file<br />";
}
}
closedir($handle);
}
?>

For me I just have that code in the index.php page in the uploads directory



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum