Sixem

PHP Basic Directory Explorer List Files In Folder

Aug 4th, 2013
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2. $files = scandir(getcwd());
  3. foreach($files as $file) {
  4.     if ($file == 'index.php' or $file == '..' or $file == '.') {
  5.     } else {
  6.     $curl_size = round((filesize($file) / 1024), 1);
  7.     $curl_name = basename($file);
  8.     echo '<table border="1">';
  9.     echo '<th>Filename</th><th>Extension</th><th>Size</th>';
  10.     echo '<tr>';
  11.     echo "<td><a href='" . $file . "'>" . $curl_name . "</a></td>";
  12.     echo "<td><a href='" . $file . "'>." . pathinfo($file, PATHINFO_EXTENSION) . "</a></td>";
  13.     echo "<td><a href='" . $file . "'>" . $curl_size . " kB</a></td></tr>";
  14.     echo '</table>';
  15.     }
  16. }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment