View Full Version : File Listing...
geor1712
05-09-2006, 02:38 PM
I have a script that allows people to upload a photo to a folder on my server - this works fine. What I want to do is use php, to create a list of each file for each file in the folder and store it in a variable / array. Anyone know how to do this??
Thanks :)
erisco
05-09-2006, 03:46 PM
Hmm. How about..
<?php
$dh = opendir("foo");
$filename = readdir($dh);
while($filename = readdir($dh))
{
$filelist[] = $filename;
}
var_dump($filelist);
?>
You just need to insert the correct path name, and presto. At least I assume heh. I added a var dump to test if it is working.
EDIT: Couple fixes.
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.