list all only files in php?
<p>I am trying to list all the files included in folder using following php scripts:</p>

<pre><code>$dir = 'd:/temp_file/voice/';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
    while (($file = readdir($dh)) !== false) {
                echo "filename: ".$file."&lt;br /&gt;";
        }
    closedir($dh);
  }
}
</code></pre>

<p>The problem is that it also shows the folder with . name which output is shown below. How can I avoid those folder.</p>

<pre><code>filename: .
filename: ..
filename: _19031265739am014771957.wav
filename: _19031265758am014771957.wav
</code></pre>
