I banged my head against this all day yesterday without success.
I have a file upload page for a client that also displays the files in their
directory folder using PHP.
Displaying the files is no problem. I loop through the directory like this:
if ($handle = opendir('./ssgi/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "<a href=\"ssgi/$file\">$file</a><br />\n";
}
}
closedir($handle);
}
However, when the directory is empty, I want to
display the text string, "There are no files in this folder", so the
client recognizes the folder is empty and not just failing to show their
files.
For the life of me, I can't find a way to determine if the folder is empty.
If there were a "directory size" function that would help, but all I can
find
is filesize. I've tried checking if $file == false or zero but there is
always a
dot (.) left in the folder which is used to move to the next directory
level.
Also, while using the loop method, eventually, the $file will always equal
false,
that's what brings the script to an end.
Can anybody lead me in the right direction here? What am I missing. It seems
that this should be very simple, but so far the solution is eluding me.
Thanks,
Perry Gerenday
Webmaster / Visual Communications
Visteon, Nashville Glass Plant
615.350.7656
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.