# Populating a list component with online dir contents

**URL:** <https://forum.kirupa.com/t/populating-a-list-component-with-online-dir-contents/316319>\
**Category:** Uncategorized\
**Created:** [November 18, 2010, 11:56am UTC](https://forum.kirupa.com/t/populating-a-list-component-with-online-dir-contents/316319 "2010-11-18T11:56:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sleazyfish](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@sleazyfish](https://forum.kirupa.com/u/sleazyfish)\
**Post date:** [November 18, 2010, 11:56am UTC](https://forum.kirupa.com/t/populating-a-list-component-with-online-dir-contents/316319/1 "2010-11-18T11:56:27Z")

</div>

Hi, I have a php script that displays the contents of a dir:

```php
 
<?php
echo "<select name=\"file\">
";
foreach (new DirectoryIterator('.') as $file) {
   // if the file is not this file, and does not start with a '.' or '..',
   // then store it for later display
   if ( (!$file->isDot()) && ($file->getFilename() != basename($_SERVER['PHP_SELF'])) ) {
      echo "<option>";
      // if the element is a directory add to the file name "(Dir)"
      echo ($file->isDir()) ? "(Dir) ".$file->getFilename() : $file->getFilename();
      echo "</option>
";
   }
}
echo "</select>
";
?>

```

this works fine when i navigate to the php file online. My problem is that i’m not sure how to use the script to populate a list component in flash.

Any help would be appreciated.

TIA
