Odilon Redon's smiling spider

File Info with SSI.
author: jim.cerny@unh.edu

last modified on Tuesday, 03-Aug-1999 16:45:00 EDT

This is an experiment with file info.

To show information about a browser-displayed file you can use some of the environment variables such as DOCUMENT_NAME and LAST_MODIFIED. But there is no environment variable for file size and these variables do not apply to arbitrary files, including non-text files, located anywhere on the Web server. Instead, for an arbitrary files you have available the SSI directives "flastmod" (last modification date) and "fsize" (file size).

   <!--#fsize virtual="URL-path-relative-to-current-doc" -->
   <!--#flastmod virtual="URL-path-relative-to-current-doc" -->
The format of the last modification date defaults to the fully detailed date as shown in the date on this document (above). See the date and time format examples for alternatives. The file size defaults to a count in "k" or "m" bytes, but can be specified in whole bytes instead. The file size directive is:
   <!--#config sizefmt="bytes-or-abbrev" -->
where "bytes" reports in whole bytes and "abbrev" reports in whole "k" or "m" bytes.

For example, on UNHINFO we have a small library of graphics files that are not very well documented. We could use SSI to document the list of graphics backgrounds files and we could do that on any Web page on the server, as shown below. The size and date formats were set for this example with the directive:

   <!--#config sizefmt="bytes" timefmt="%d-%b-%Y %R" -->

The UNHINFO /Graphics/Backs/ Library:

file size update
bluepad.gif 352 14-Jun-1999 08:13
draftpage.gif 6,847 13-Nov-1997 16:13
draftpage-lt.gif 3,071 14-Jun-1999 15:41
faqsign-maroon-back.gif 1,342 02-Oct-1998 08:30
spiral-notebook.gif 1,531 14-Jun-1999 08:09
wave-groovy-sm.gif 1,991 25-Aug-1998 15:22
yellowpad.gif 384 13-Aug-1996 13:51

Return to Courses page.