CFCONTENT

Defines the MIME type returned by the current page. Optionally, allows you to specify the name of a file to be returned with the page.

Note The ColdFusion Server Basic security settings may prevent CFCONTENT from executing. These settings are managed using the ColdFusion Administrator Basic Security page. In order for CFCONTENT to execute, it needs to be enabled on the Basic Security page. Please refer to Administering ColdFusion Serverfor more information about securing ColdFusion tags.

Syntax

<CFCONTENT TYPE="file_type"
    DELETEFILE="Yes/No"
    FILE="filename"
    RESET="Yes/No">

TYPE

Required. Defines the File/ MIME content type returned by the current page.

DELETEFILE

Optional. Yes or No. Yes deletes the file after the download operation. Defaults to No. This attribute only applies if you are specifying a file with the FILE attribute.

FILE

Optional. Denotes the name of the file being retrieved.

RESET

Optional. Yes or No. Yes discards any output that precedes the call to CFCONTENT. No preserves the output that precedes the call. Defaults to Yes. The RESET and FILE attributes are mutually exclusive. If you specify a file, the RESET attribute has no effect. See Note.

Note You should consider setting RESET to "No " if you are calling CFCONTENT from a custom tag and do not want the tag to have the side effect of discarding the current page whenever it is called from another application or custom tag.

Example

<!---  This example shows the use of CFCONTENT to return the
contents of the CF Documentation page dynamically to the browser.
You may need to change the path and/or drive letter. 
(graphics will not display) --->
<HTML>
<HEAD>
<TITLE>
CFCONTENT Example
</TITLE>
</HEAD>

<BODY>

<H3>CFCONTENT Example</H3>

<!--- Files may be set to delete after downloading,
allowing for the posting of changing content. --->
<CFCONTENT TYPE="text/html" 
   FILE="c:\inetpub\wwwroot\cfdocs\main.htm" DELETEFILE="No">

</BODY>
</HTML>       

<!--- This example shows how the RESET attribute changes textual 
        output. --->
<HTML>
<HEAD>
<TITLE>
CFCONTENT Example 2
</TITLE>
</HEAD>

<BODY>
<H3>CFCONTENT Example 2</H3>


<P>This example shows how the RESET attribute changes the output for 
text.</P>
<P>RESET = "Yes ": 123<CFCONTENT type="text/html" reset= "Yes ">456</P>
<P>This example shows how the RESET attribute changes the output for 
text.</P>
<P>RESET = "No ": 123<CFCONTENT type="text/html" reset= "No ">456</P>
</BODY>
</HTML>