This code can list the contents of a directory on the server that is serving a webpage running the code.
In order for this to work, Apache needs to be running mod-autoindex.
http://httpd.apache.org/docs/2.2/mod/mod_autoindex.xml
Apache autoindexing allows basic sorting and formating by appending a query string.
For instance, http://someserver/somepath/somedir/?C=M;O=A will
sort the listing by modification date in ascending order.
- C=N sorts the directory by file name
- C=M sorts the directory by last-modified date, then file name
- C=S sorts the directory by size, then file name
- C=D sorts the directory by description, then file name
- O=A sorts the listing in Ascending Order
- O=D sorts the listing in Descending Order
- F=0 formats the listing as a simple list (not FancyIndexed)
- F=1 formats the listing as a FancyIndexed list
- F=2 formats the listing as an HTMLTable FancyIndexed list
- V=0 disables version sorting
- V=1 enables version sorting
- P=pattern lists only files matching the given pattern