Search for file in folder using php
<p>I am storing user uploaded files like pdf images and txt files in separate folders using my php script i want to retrieve the file names from the folder upload and give the pdf and txt in a group and also way to search for specific file.</p>

<p>I also need to rename the file before to <code>$ja</code> variable</p>

<pre><code>$ja
$da = date("dmY");
$ja = $uid.$da;

    move_uploaded_file($mi, $uploadpath)
</code></pre>

<p>also used this code which i found in stack</p>

<p>Example 01:</p>

<pre><code>&lt;?php
  // read all files inside the given directory
  // limited to a specific file extension
  $files = glob("./ABC/*.txt");
?&gt;
</code></pre>

<p>Example 02:</p>

<pre><code>&lt;?php
  // perform actions for each file found
  foreach (glob("./ABC/*.txt") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
  }
?&gt;
</code></pre>
