fileReadBinary
Description
Reads an on-disk or in-memory binary file (such as an executable or image file) on the server, into a binary object parameter that you can use in the page. To send it through a web protocol (such as HTTP or SMTP) or store it in a database, first convert it to Base64 by using the ToBase64 function.
Categories
Related
History
ColdFusion
8: Added this function.
Syntax
FileReadBinary(filepath)
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| filepath | An absolute path to an on-disk or in-memory binary file on the server |
Returns
The
entire contents of a binary file.
Usage
You convert the binary file to Base64 to transfer it to another site. ColdFusion 8 supports reading an image file as a binary and passing the result to a cfimage.
Example
The
following example reads a binary file.
<h3>FileReadBinary Example</h3>
<cfscript>
myfile = FileReadBinary("c:\testingdir\test3.jpg");
</cfscript>