User Guide
334 Chapter 18 Interacting with Remote Servers
To get a binary file and save it:
1 Open a new file in ColdFusion Studio.
2 Modify the file so that it appears as follows:
<cfhttp
method="Get"
url="http://localhost/myapps/testfile.zip"
path="c:\temp"
file="MyTestFile.zip">
<cfoutput>
#cfhttp.MimeType#
</cfoutput>
3 Change the URL to point to a binary file you want to download.
4 Change the path to point to a path on your hard drive.
5 Save the file as savebinary.cfm in myapps under your Web root directory and
view it in your browser.
Reviewing the code
The following table describes the code and its function:
Code Description
<cfhttp
method="Get"
url="http://localhost/myapps/testfile.zip"
path="c:\temp"
file="MyTestFile.zip">
Get a binary file and save it in
the
path and file specified.
<cfoutput>
#
cfhttp.MimeType#
</cfoutput>
Display the MIME type of the
file.