Created
March 24, 2014 23:53
-
-
Save bennadel/9752015 to your computer and use it in GitHub Desktop.
Streaming Text Using ColdFusion's CFContent Tag And The Variable Attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
Store the text you want to stream. This could be done | |
here, or it could be gotten from a different part of | |
the application. | |
---> | |
<cfsavecontent variable="strText"> | |
This is some cool text. | |
</cfsavecontent> | |
<!--- Set the header info to force that file attachment. ---> | |
<cfheader | |
name="Content-Disposition" | |
value="attachment; filename=streamed_text.txt" | |
/> | |
<!--- | |
Stream the text. To do so, we have to convert it to | |
Base64 first, then convert that to binary. | |
---> | |
<cfcontent | |
type="text/plain" | |
reset="true" | |
variable="#ToBinary( ToBase64( strText ) )#" | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment