cfcontent

Does either or both of the following:
* Sets the MIME content encoding header for the current page
* Sends the contents of a file from the server as the page
output

  <cfcontent>

 cfcontent();

Attribute Reference

type string

The MIME content type of the page, optionally followed by
a semicolon and the character encoding. By default,
CFML sends pages as text/html content type in
the UTF-8 character encoding.

deletefile boolean
Default: false

Applies only if you specify a file with the file attribute.

Yes: deletes the file on the server after sending its
contents to the client.
No: leaves the file on the server.

file string

Name of file whose contents will be the page output. When
using CFML in a distributed configuration, the file
attribute must refer to a path on the system on which the
web server runs. When you use this attribute, any other
output on the current CFML page is ignored; only the
contents of the file is sent to the client.

variable string

Name of a ColdFusion MX binary variable whose contents can
be displayed by the browser, such as the contents of a chart
generated by the cfchart tag or a PDF or Excel file
retrieved by a cffile action="readBinary" tag.
When you use this attribute, any other output on the current
CFML page is ignored; only the contents of the file are sent
to the client.

reset boolean
Default: true

The reset and file attributes are mutually exclusive.
If you specify a file, this attribute has no effect.

Yes: discards output that precedes call to cfcontent
No: preserves output that precedes call to cfcontent. In
this case all output is sent with the specified type.

Examples
Sample code using the cfcontent tag

<cfcontent type="application/vnd.ms-excel" file="c:/temp/acmesales03.xls"> 

cfcontent(type="application/vnd.ms-excel", file="c:/temp/acmesales03.xls");

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub