title: How can I display and list all PDF files in a directory in an HTML Table, in their descending order of their upload date?
body: <p>I have made an upload.php which makes it possible for the user to upload file on server in their respective folders, based on the drop-down selections. It also renames the file with the date, the user sets.
  Now, I want to display all those PDF's in a specific directory within a table. I have found this code:</p>
  
  <pre><code>&lt;div class="table-responsive"&gt;
      &lt;table class="table table-striped table-bordered"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Filename&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
  
    &lt;?php
      $files = scandir('./uploads/ffbl/daily');
      rsort($files); // this does the sorting
      foreach($files as $file)
      {
        echo'&lt;tr&gt;&lt;td&gt;&lt;a href="/uploads/ffbl/daily/'.$file.'"&gt;'.$file.'&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';
      }
    ?&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>However, it displays all the files, not only PDF's. Moreover, files should be in descending order of their upload date / time. </p>