cfcontent

Description

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

Category

Data output tags


Note

In the ColdFusion Administrator, the security settings on the Tag Restrictions page under ColdFusion Basic Security may prevent cfcontent from executing. The cfcontent tag must be enabled. For more information, see Advanced ColdFusion Administration.


Syntax


<cfcontent type = "file_type"

  deleteFile = "Yes" or "No"

  file = "filename"

  reset = "Yes" or "No"> 

See also

cfcol, cfoutput, cftable

Attributes

Attribute
Description
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 applies only if you specify a file with the file attribute.
file
Optional. The name of the file being retrieved.
reset
Optional. Yes or No. Yes discards 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

Consider setting reset to No if you call cfcontent from a custom tag and do not want the tag to discard the current page when 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> 



Banner.Novgorod.Ru