PHP File Listing

About

Most PHP listing scripts are hideous monsters, producing overwrought HTML listings full of styles and preview systems. This script aims to keep things simple, providing a single table with only the information that would be included on a normal directory listing — name, filesize, mime type and mtime.

This script does provide some preview features, but they are all client-side, and implemented in JavaScript. This means they disable themselves gracefully where a client does not have JavaScript support. Previews also provide full back/forward ability using the history API in modern browsers.

Download

Download the PHP by renaming this text file.

Usage

Simply pop the file where you want and set the variables at the top of the file:

WEBPATH
The path to use for the root of all links to files.
DISKPATH
The location on disk of files to index
BLACKLIST
A list of files not to list. By default merely excludes the up/here directory listings.
DATEFORMAT
PHP-style date format used for mtime output.
GALLERYTITLE
The title used for the gallery.
BINARYSIZE
Boolean: true if you wish to use base 2 for filesize humanisation (KiB, MiB etc), false to use base 10.

I highly recommend integrating the script using css, and adding a header etc...