Some ColdFusion tags return data as variables. For example, the cffile
tag returns file size information in the FileSize variable, referenced as CFFILE.FileSize.
The following tags return data that can be referenced in variables:
cfcatch
cfdirectory cferror cffile cfftp cfhttp cfindex cfldap cfmail cfpop cfquery cfregistry cfsearch cfstoredproc
A ColdFusion tag that returns a query object supports the following variables, where queryname is the value of the name
attribute:
queryname.CurrentRow
queryname.RecordCount queryname.ColumnList
Within a cfcatch
block, the active exception properties can be accessed as the following variables:
CFCATCH.Type
CFCATCH.Message CFCATCH.Detail CFCATCH.ErrNumber CFCATCH.NativeErrorCode CFCATCH.SQLState CFCATCH.LockName CFCATCH.LockOperation CFCATCH.MissingFileName CFCATCH.TagContext CFCATCH.ErrorCode CFCATCH.ExtendedInfo
The cfdirectory
tag, with action=list
, returns a query object as follows, where queryname is the name
attribute value:
queryname.Name
queryname.Size queryname.Type queryname.DateLastModified queryname.Attributes queryname.Mode
When cferror
generates an error page, the following error variables are available if type="request"
, "exception"
, or "monitor"
.
Error.Diagnostics
Error.MailTo Error.DateTime Error.Browser Error.GeneratedContent Error.RemoteAddress Error.HTTPReferer Error.Template Error.QueryString
The following error variables are available if type="validation
".
Error.ValidationHeader
Error.InvalidFields Error.ValidationFooter
Any cfcatch
variable that applies to exception type can be accessed within the Error scope, as follows:
Error.Type
Error.Message Error.Detail Error.ErrNumber Error.NativeErrorCode Error.SQLState Error.LockName Error.LockOperation Error.MissingFileName Error.TagContext Error.ErrorCode Error.ExtendedInfo
Note: You can substitute the prefix CFERROR for Error, if type = "Exception"
or "Monitor"
; for example, CFERROR.Diagnostics, CFERROR.Mailto or CFERROR.DateTime.
File variables are read-only. Use the CFFILE prefix to reference file variables; for example, CFFILE.ClientDirectory. The File prefix is deprecated in favor of the CFFILE prefix.
CFFILE.AttemptedServerFile
CFFILE.ClientDirectory CFFILE.ClientFile CFFILE.ClientFileExt CFFILE.ClientFileName CFFILE.ContentSubType CFFILE.ContentType CFFILE.DateLastAccessed CFFILE.FileExisted CFFILE.FileSize CFFILE.FileWasAppended CFFILE.FileWasOverwritten CFFILE.FileWasRenamed CFFILE.FileWasSaved CFFILE.OldFileSize CFFILE.ServerDirectory CFFILE.ServerFile CFFILE.ServerFileExt CFFILE.ServerFileName CFFILE.TimeCreated CFFILE.TimeLastModified
When you use the cfftp stoponerror
attribute, these variables are populated:
CFFTP.Succeeded
CFFTP.ErrorCode CFFTP.ErrorText
Some cfftp
file and directory operations provide a return value, in the variable CFFTP.ReturnValue. Its value is determined by the results of the action
attribute. When you specify any of the following actions, cfftp
returns a value:
GetCurrentDir
GetCurrentURL ExistsDir ExistsFile Exists
When you use the cfftp
tag with the listdir
action, cfftp
returns a query object, where queryname is the name
attribute value, and row is the row number of each file or directory entry:
queryname.Name[row]
queryname.Path[row] queryname.URL[row] queryname.Length[row] queryname.LastModified[row] queryname.Attributes queryname.IsDirectory queryname.Mode
A cfhttp get
operation can return text and binary files. Files are downloaded and the contents stored in a variable or file, depending on the MIME type, as follows:
CFHTTP.FileContent
CFHTTP.MimeTypeCFHTTP.Header
CFHTTP.ResponseHeader
[http_hd_key] CFHTTP.StatusCode
The cfldap
action=query
tag returns information about the LDAP query, as follows:
queryname.CurrentRow
queryname.RecordCount queryname.ColumnList
The cfpop
tag returns the following result columns, depending on the action
attribute value and the use of other attributes, such as attachmentpath
, where queryname is the name
attribute value:
queryname.Date
queryname.From queryname.Body queryname.Header queryname.MessageNumber queryname.ReplyTo queryname.Subject queryname.CC queryname.To queryname.CurrentRow queryname.RecordCount queryname.ColumnList queryname.Attachments queryname.AttachmentFiles
The cfquery
tag returns information about the query in this variable:
CFQUERY.ExecutionTime
The cfquery
tag uses the query name to scope the following data about the query:
queryname.CurrentRow
queryname.RecordCount queryname.ColumnList
The cfstoredproc
tag returns the following variables:
CFSTOREDPROC.ExecutionTime
CFSTOREDPROC.StatusCode
The cfregistry
tag returns a query record set that you can reference after executing the GetAll
action, as follows, where queryname is the name
attribute value:
queryname.Entry
queryname.Type queryname.Value
A cfsearch
operation returns the following variables, where searchname is the name
attribute value:
searchname.URL
searchname.Key searchname.Title searchname.Score searchname.Custom1 and Custom2 searchname.Summary searchname.RecordCount searchname.CurrentRow searchname.RecordsSearched searchname.ColumnList