PHP Classes

File: readme.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Gregory Lane  >  File Display  >  readme.txt  >  Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Readme
Class: File Display
Displays listings of files and directories
Author: By
Last change: Added instructions about using images for directory and file icons.
Date: 12 years ago
Size: 1,905 bytes


Class file image Download
Documentation for FileDisplay class

Created by Greg Lane, Nov 3rd, 2003


Lesser GPL.  (See for more details.)


The FileDisplay class will show a directory listing of folders and files
in a specified root directory.  (actually only images and folders - if you
alter the checkext method, you can display all or a limited selection of
The class adds links to each subdirectory.  When you click on a subdirectory,
the page reloads and the contents of the subfolder (including any subdirectories)
is displayed.  You can display an endless number of subdirectories, but the
filepath from the root directory is displayed at the top of the page, so the
formatting might get a little messy if you explore too deep!


Upload the file and the images to your web server.
You will need to create at least two icon images (1 for files & the other
for directories) and put them in the same directory as
Apache has some good images in the 'icons' directory.


See accompanying file - test_FileDisplay.php
For explanations of each of the methods of the class, see the comments in


The target folder information is contained in the query string.  So that users
don't enter ../../ in the querystring and explore your entire file system, the
code checks that the root directory (a directory of your choosing) is a sub 
string of the target dir. 

Last Comments:

This is the first class I've submitted.  I know it doesn't do anything
revolutionary, but it's simple, self-contained and meets the needs for which
I designed it.
If you have any fixes, suggestions, rewrites, additions, please let me know.