Chapter 2: ColdFusion Functions
543
ToBase64
Returns the Base 64 representation of the string or binary object. Base64 is a format
that uses printable characters, allowing binary data to be sent in forms and Email, and
stored in a database or file.
See also
CFFILE
for information about loading and reading binary data,
CFWDDX
for
information about serializing and deserializing binary data, and
IsBinary
and
ToBinary
for checking for binary data and converting a Base 64 object to binary form.
Syntax
ToBase64
(
string or binary_object)
string or binary_object
String or binary object that is to be converted to Base 64.
Usage
Base 64 provides 6 bit encoding of 8-bit ASCII characters. Because high ASCII values
and binary objects are not safe for transport over internet protocols such as HTTP and
SMTP, ColdFusion offers Base 64 as a means to safely send ASCII and binary data over
these protocols.
In addition, Base 64 allows you to store binary objects in a database if you convert the
data into Base 64 first.
Examples
<!--- This example shows the use of ToBinary and ToBase64 --->
<HTML>
<HEAD>
<TITLE>
ToBase64 Example
</TITLE>
</HEAD>
<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY bgcolor="#FFFFD5">
<H3>ToBase64 Example</H3>
<!----------------------------------------------------------------------
Initialize data.
----------------------------------------------------------------------->
<CFSET charData ="">
<!----------------------------------------------------------------------
Create a string of all ASCII characters (32-255) and concatenate them
together.
----------------------------------------------------------------------->
<CFLOOP index="data" from="32" to="255">
<CFSET ch=chr(data)>
<CFSET charData=charData & ch>
</CFLOOP>
<P>
The following string is the concatenation of all characters (32 to 255)
from the ASCII table.<BR>
Содержание COLDFUSION 4.5-CFML LANGUAGE
Страница 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Страница 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Страница 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Страница 296: ...272 CFMLLanguageReference INPUT TYPE text NAME number2 BR INPUT TYPE submit NAME submit VALUE Add FORM BODY HTML...
Страница 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Страница 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Страница 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Страница 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Страница 557: ...Chapter 2 ColdFusion Functions 533 P CFOUTPUT Value i is employee keysToStruct i CFOUTPUT P CFLOOP CFIF BODY HTML...
Страница 584: ...560 CFMLLanguageReference...
Страница 594: ...570 CFMLLanguageReference...