get a list of files ordered by upload time


/ Published in: PHP
Save to your folder(s)

This is another way to get a list of files ordered by upload time.


Copy this code and paste it in your HTML
  1. <?php
  2. foreach (glob("../downloads/*") as $path) { //configure path
  3. $docs[filectime($path)] = $path;
  4. } ksort($docs); // sort by key (timestamp)
  5.  
  6. foreach ($docs as $timestamp => $path) {
  7. print date("d. M. Y: ", $timestamp);
  8. print '<a href="'. $path .'">'. basename($path) .'</a><br />';
  9. }
  10. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.