<varinfo $action [flags ...] [$arg]>
varinfo function returns various information about
variables, depending on the value of the
listReturns the names of all known variables in the current scope. This includes unlisted environment/CGI variables only accessible via
getvar. If the optional
$argargument is given, then only variables from a specific source will be returned:
URLfor URL (query string) variables
ENVfor environment variables
POSTmethod form variables
POSTand/or query-string variables
COOKIEfor cookie variables
getvarto obtain its value(s).
sizeReturns the size in bytes of each corresponding value of the variable named by
$arg. This is useful to obtain the true size of a
varbytevariable such as an image, where
strlenmight stop short.
typeReturns the SQL type of the variable named by
$arg, as a string. The
typeaction was added in version 2.6.929000000 19990610.
dumpReturns debug information about the variable named by
$arg, as a string. This information is in the same format as printed by the
$?myVardebug syntax (here). Accessing debug info via
<varinfo dump>can be used when the variable name must be determined dynamically at run-time, precluding usage of the easier (but static-name)
$?myVarsyntax. Added in version 6.
dump, but more verbose: uses the
syntax. Added in version 6. In version 7.03 and later, this is
deprecated: use <varinfo dump verbose ...> instead.
The following actions are applicable only to
variables from a multipart MIME file upload (here).
For any other variables, nothing is returned:
filenameReturns the filename for the variable named by
$arg, from the
Content-Dispositionheader. This corresponds to the name of the file the user gave for that field, from their system. Note that the full path is generally not available; only the filename is usually sent by the browser.
Content-Typefor the variable given by
In version 7.03 and later, the following flags may be set before the
$arg argument. Currently they are only valid for the
Force HTML-escapement of variable values printed by
regardless of HTML mode.
Force as-is (no HTML escapement) printing of variable values
dump. By default, HTML escapement happens if
the script is in HTML mode; using this flag may be useful to avoid
escapement when an HTML-mode Web script is being debugged to a log
file that is being read as plain text.
Dump variables in verbose mode (ala
varinfo function returns various information about variables,
per its arguments.
<FORM METHOD=post ACTION="$url/test.html"
Image: <INPUT TYPE=file NAME=image>
<INPUT TYPE=submit NAME=submit>
<varinfo list CGI>
Form variables are: <LOOP $ret> $ret </LOOP> <BR>
<varinfo filename "image">
You uploaded the file "$ret".
<varinfo contenttype "image">
It is of type "$ret" and
<varinfo size "image"> $ret bytes in size.
varinfo function was added in version 2.6.926900000 19990517.
size of variables is the size of the native type, not the
string representation as
strlen would return. E.g. integer vars
on a 32-bit machine will always have a
size of 4.
list cgi action will return CGI variable names,
their values, obtained with the
getvar function, may be
different if the variable(s) have been modified. Similarly, the
contenttype of variables may not correspond
to their current values, if they were modified.