Read a binary file, such as an executable or image file. The file is read into a binary object parameter you can use anywhere in the page, like any other parameter. To send it through a Web protocol, such as HTTP or SMTP, or store it in a database, first convert it to Base64 (see "ToBase64").
<cffile action = "readBinary" file = "full_path_name" variable = "var_name">
Attribute |
Description |
---|---|
file |
Required. The full pathname of the file to be read. |
variable |
Required. The name of the variable that will contain the contents of the binary file after it has been read. |
You convert the binary file to Base64 to FTP it to another site for upload.
The following example creates a variable named "aBinaryObj " to contain the ColdFusion Server executable.
<cffile action = "readBinary" file = "c:\cfusion\bin\cfserver.exe" variable = "aBinaryObj">