Revision [14907]
This is an old revision of SmaugDragon made by SmaugDragon on 2006-07-20 12:50:50.
examples:
{{fileview location="uploads/*.*"}} will show all files in uploads directory
{{fileview location="uploads/*.zip}} will show only zip files in uploads directory
{{fileview location="uploads/pic???.jpg}} will show only jpg files with names like pic000.jpg pic001.jpg etc
Additionally you can set $md5checksum on or off in the fileview.php file to have md5checksums generated on the fly [off by default].
(Not recomended for large directories or files)
- <style type="text/css">
- table {border:1px solid #000; border-collapse:collapse; font-family:arial,courier,sans-serif; font-size:90%; }
- td,th{border:0px solid #000; border-collapse:collapse; padding:5px; }
- thead th{text-align:center; background:#9cf; }
- tbody th{text-align:center; background:#69c; }
- tbody td{text-align:right; background:#DDDDDD; }
- #ic{width: 0px;}
- #nm{width: 80px; text-align: left; nowrap;}
- #sz{width: 80px; text-align: right; nowrap;}
- #mf{width: 80px; text-align: right; nowrap;}
- #cd{width:120px; text-align:right; font-family:courier; nowrap;}
- </style>
- <?php
- if (!$location) { $location = "uploads/*.*"; } /* if location is not specified show all files in uploads */
- $md5checksum_on = 1; /* calculate md5 checksums (1 = yes | 0 = no) */
- /* Taken from WikkaWakka actions files.php */
- function bytesToHumanReadableUsage($bytes, $precision = 2, $names = '')
- {
- return false;
- }
- for ($level = 0; $bytes >= 1024; $level++) { $bytes /= 1024; }
- switch ($level)
- {
- }
- return false;
- }
- }
- /* End of borrowed Code */
- echo "<table summary=\"This table lists the files ".$location."\">\n";
- echo "<tr><th scope=\"col\"> </th><th scope=\"col\">File</th><th scope=\"col\">Size</th><th scope=\"col\">Modified</th>";
- if ($md5checksum_on == 1) echo "<th scope=\"col\">md5 Checksum</th></tr>\n"; else echo "</tr>\n";
- echo "<td id=\"ic\"></td>";
- echo "<td id=\"nm\"><a href=".$filename.">$filename</a>";
- echo "</tr>\n";
- }
- echo "</table>";
- ?>