including certain files


#1

Hey, im wondering if its possible to have php include all the files from the current directory, and post the description (variable set in included files) and a link to that file, similar to the phpBB admin panel, where you upload a new hack, and its automatically added to that page


#2

Do you want to INCLUDE them or just display a link to the file. By using INCLUDE you actually make the file contents of the included file(s) a part of the web page. Answering this question… YES it is possible. I am not really sure what you are talking abou with the LINK and the DESCRIPTION portion. If you could kind of give a clearer example or a sample of code of what it is you think you want to do, it might be easier.


#3

i want to make a link to the file.


#4

do you mean something like this: http://www.knightcommander.karoo.net/php_dl.html


#5

Perhaps something like this might help

$dir = '/path/to/the/dir';
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
   echo "<a href='http://www.domain.com/appropriate/path/$file'>$file</a><br> n";
}
 
closedir($dh);