How to avoid Parent Directory Link when listing the files of a Directory?
<p>I used the following code to display the contents of a Folder say images (Both Directories as well as Files in that folder)  </p>

<pre><code>&lt;?php

$dir="images/"; // Directory where files are stored

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
    $newvar1="$dir$filename";// For Hyperlink Path
?&gt;
&lt;p&gt;&lt;a href="&lt;?php echo $newvar1; ?&gt;"&gt;&lt;?php echo $filename;
?&gt;&lt;/a&gt;&lt;/p&gt;
&lt;?php
}
closedir($dir_list);
}

?&gt;
</code></pre>

<p>But the PHP file shows an output with two additional Links</p>

<ol>
<li>A link to the folder 'images' and</li>
<li>A Link to the 'Homepage'.</li>
</ol>

<p>I tried to filter those two links with "filesize" function but getting some error.</p>

<p>How can I resolve this?</p>
