Bas,
I think the following should work though it might need some tweaking as it's some
weeks since I did:
$dir = "directoryname";
$dp = opendir($dir);
$filenames = array();
while($file = readdir($dp))
{
array_push($filenames, $file);
}
// Compile an array of the files
for($i = 0; $i < count($filenames); $i ++)
{
if(!(is_dir("$dir/$filenames[$i]")))
{
echo $filenames[$i]."<br>";
}
}
You can probably print out the filenames at the first stage - I think there was a
reason why I was passing them into a separate array but I've forgotten what it was!!
Regards,
Michael Egan
-----Original Message-----
From: Bas [mailto:[EMAIL PROTECTED]
Sent: 17 October 2003 13:42
To: [EMAIL PROTECTED]
Subject: [PHP] How can i print out the files in a directory?[Scanned]
How can i print out all of the files in a directory?
I want some output as this:
index.php
login.php
image1.gif
image2.jpg
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php