The #fsize and #flastmod Commands

The #fsize command will insert the size of the specified file into the document. There are occasions when you may want a visitor to your web site to download information which could be substantial in size. In these cases it is polite to include the file size in the document so the visitor can estimate how long the download will take. You could include the file size directly in the HTML, but if the files were to change you would need to update the HTML pages as well. The #fsize command allows you to include the size of files which may change regularly.

The #fsize command is followed by the parameters file or virtual with the same meaning as the #include command described above. Each parameter take a file location as an argument.

The #flastmod command works in the same manner returning the data the file was last modified.

By using the recursive nature of the Zeus SSI engine it would be possible to generate a file listing from a CGI script, but obtain the file sizes and modification dates via the SSI commands.

Simple Example: File Size of Downloads

A University publishes hourly satellite pictures on the web. Due to the difference in time and weather, combined with the effect of the compression code, the size can alter considerably. Using the #fsize and #flastmod commands the web page always has the correct information displayed.

The .shtml file:

<html>
<head>
<title>Pictures</title>
</head>
<body>
<h1>Satellite Pictures</h1>
Please download the <a href="picture.jpg">picture</a>, it is only
<!--#fsize file="picture.jpg"--> in size. <br>
Last updated on <!--#flastmod file="picture.jpg"-->
</body>
</html>

Will result in something similar to the following being sent to the client:

<html>
<head>
<title>Pictures</title>
</head>
<body>
<h1>Satellite Pictures</h1>
Please download the <a href="picture.jpg">picture</a>, it is only
4.8Kb in size.
Last updated on 05:52:21 PM 06/03/97
</body>
</html>
Content Manager [Administrator] 16 December 2005  Permalink  
Download Free Trial

Recent Articles

Other Resources



www.zeus.com