
Originally Posted by
CSU-Bill
Well, I had the script working, and failed to realize it was locked on only three files. I created an upload form and uploaded a couple of pdf files that do not show up in the list.
PHP Code:
<?php
foreach (new DirectoryIterator('../documents') as $fileInfo) {
if($fileInfo->isDot()) continue;
echo '<a href="/documents/' . $fileInfo->getFilename() . ' ">' . $fileInfo->getFilename() . '</a><br> ';
}
?>
This worked once, and I do not remember changing this, but is there an error here?
i think this is the problem..
PHP Code:
foreach (new DirectoryIterator('../documents') as $fileInfo)
try to instantiate the class to a variable first before placing it in a loop..
PHP Code:
$di = new DirectoryIterator('../documents');
foreach ($di as $fileInfo)
and also i think that new DirectoryIterator('../documents') will not return an array..
maybe you need to execute a method first?
PHP Code:
$di = new DirectoryIterator('../documents');
foreach ($di->getSomething() as $fileInfo)
Bookmarks