The fsize
command allows you to report the size of
a file inside a document. The file size.shtml is
as follows:
<!--#config errmsg="Bungled again!"--> <!--#config sizefmt="bytes"--> The size of this file is <!--#fsize file="size.shtml"--> bytes. The size of another_file is <!--#fsize file="another_file"--> bytes.
The first line provides an error message. The second line means that
the size of any files is reported in bytes printed as a number, for
instance, 89. Changing bytes
to
abbrev
gets the size in kilobytes, printed as
1k
. The third line prints the size of
size.shtml itself; the fourth line prints the
size of another_file. config
commands must appear above commands that might want to use them.
You can replace the word file=
in this script, and
in those which follow, with virtual=
, which gives
a %-encoded URL path relative to the document root. If it does not
begin with a slash, it is taken to be relative to the current
document.
If you play with this stuff, you find that Apache is strict about the syntax. For instance, trailing spaces cause an error because valid filenames don’t have them:
The size of this file is <!--#fsize file="size.shtml "--> bytes. The size of this file is Bungled again! bytes.
If we had not used the errmsg
command, we would
see the following:
...[an error occurred while processing this directive]...