# Thread: parsing all files in a folder

1. ## parsing all files in a folder

Here is what I want to do. Have a number of images in a folder. Put the file in there (more advanced version would let me specify folder path of course) and then when I click parse files it will parse all the file names and allow me to upload them to a db?

2. Something like this maybe?
PHP Code:
 <?phptry{    $aFiles = array(); foreach (new DirectoryIterator(realpath(dirname(__FILE__))) as$oFile)    {        if(false === $oFile->isDir()) { array_push($aFiles,                array(                    'directory'    =>    $oFile->getPath(), 'filename' =>$oFile->getFilename()                )            );        }    }    print_r($aFiles); /* Array ( [0] => Array ( [directory] => C:\path\to\directory [filename] => foo.jpg ) ) */}catch(Exception$oException){    echo \$oException->getMessage();}?> 

3. thank you will try it out

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•