# Trying only to get images into my array

**URL:** <https://forum.kirupa.com/t/trying-only-to-get-images-into-my-array/161256>\
**Category:** Uncategorized\
**Created:** [September 2, 2005, 6:34am UTC](https://forum.kirupa.com/t/trying-only-to-get-images-into-my-array/161256 "2005-09-02T06:34:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henxon](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@Henxon](https://forum.kirupa.com/u/Henxon)\
**Post date:** [September 2, 2005, 6:34am UTC](https://forum.kirupa.com/t/trying-only-to-get-images-into-my-array/161256/1 "2005-09-02T06:34:06Z")

</div>

Hello!

I have this PHP code to get files from a folder on my server into an array, which I use in flash:

```php

<?php
$dir = opendir("producers/");
while ($file = readdir($dir)) {
if ($file=="." or $file=="..") continue;
$string.= $file;
$string.= ", ";
}
echo "imgList=".$string;
?> 

```

The problem is that I just want images from that folder to get into the array, not all files! How can I do that? It’s enough to only handle jpg’s, though several file types are nicer =)

//regards, henxon
