fileinfo

[fileinfo] will display information about a nominated file or folder.
[fileinfo file=archives/sales2021.txt][/fileinfo]

Parameters

ParameterDescription
fileThe path to the file/folder which is to be queried. This path is relative to the template.

The following tags are available inside a [fileinfo] context:

TagDescription
[isfolder]"T" if this item is a folder. If it is a file the result will be "F".
[isfile]"T" if this item is a file. If it is a foler the result will be "F".
[exists]"T" if this file/folder actually exists on disk.
[filename]Name of the file.
[fullpath]Full path to the file.
[moddate]Last date the file was modified.
[modtime]Last time the file was modified.
[size]The size of the file, in bytes.
[startpath]The folder path leading to the file.
[imagewidth]If the file is a GIF or JPEG file, displays the image's width in pixels. This can be very slow for large JPEG files, because the entire file must be read into memory first. We suggest you do this only once, then store the information in a database somewhere.
[imageheight]If the file is a GIF or JPEG file, displays the image's height in pixels. This can be very slow for large JPEG files, because the entire file must be read into memory first. We suggest you do this only once, then store the information in a database somewhere.
Example WebDNA code:
To display information about a file or folder (including whether it exists or not), place a [FileInfo] context into a WebDNA template. Specify an absolute or relative path to the file in the same way as you would specify an absolute or relative URL. The file name itself may be a WebDNA [xxx] tag.
[fileinfo file=../images/background.jpg]
  File Name: [filename]
  Modified: [moddate]
  Size: [size]
[/fileinfo]