File List Script

Status
Not open for further replies.

Christopher

Retired
Messages
14,659
Reaction score
8
Points
0
I'm in need of a script that will show a list of all the files in a directory called webhunts. And if possible make them links to the file and remove the .php ending. Please help me with this. My computer teacher asked me to make a site where she could upload a webhunt and it would be shown on the homepage. I've got the backend made. Just don't know how to do the file listing. Thanks!

Edit: Right now I'm showing the list of files in the directory using iframe. Is that the best way?
 
Last edited:

Micro

Retired staff <i> (11-12-2008)</I>
Messages
1,301
Reaction score
0
Points
36
Code:
<?php
$d = dir("INSERT DIRECTORY HERE -- INCLUDING /home/username/www");
$urltofolder  = "http://www.domain.com/urltofolderwithout/"; // Dont put a / on the end.
while (false !== ($entry = $d->read())) {
   if($entry != "." or $entry != ".."){
   echo "<a href='" . $urltofolder . "/" . $entry . "'>" . $entry . "</a><br/>";
   }
}
$d->close();
?>

That should work.
 

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
Thanks i needed that too..
 
Status
Not open for further replies.
Top