User Guide
Chapter 15: Interacting with Remote Servers 237
You have POSTed to me.<BR>
<CFFILE DESTINATION="c:\temp\junk"
NAMECONFLICT="Overwrite"
FILEFIELD="myfile"
ACTION="Upload"
ATTRIBUTES="Normal">
<CFOUTPUT>
The URL variable is: #url.myurl# <BR>
The Cookie variable is: #cookie.mycookie6# <BR>
The CGI variable is: #cgi.mycgi#. <BR>
The Formfield variable is: #form.myformfield#. <BR>
</CFOUTPUT>
3. Replace c:\temp\junk with a path and filename on your hard drive.
4. Save the file as
posttest.cfm in myapps under your Web root directory.
This example uses the CFFILE tag to upload the contents of the file variable to
c:\temp\junk.
It passes the five supported variable types to the page specified in the URL attribute.
The page that receives this data is also shown. It returns the value of the variables
which appears in the client’s browser. This example uses the CFFILE tag in the page
that receives the Posted variables to upload the contents of the file variable to
c:\temp\junk.
The CFOUTPUT section in posttest.cfm references the CFHTTP.FileContent
variable, which is used to display the output from the
server.cfm file. If the
CFHTTP.FileContents variable were left out, the browser output would be limited to
the contents of the
posttest.cfm file.
To return resuls of a CGI program:
1. Create a new file in Studio.
2. Modify the file so that it appears as follows:
<CFHTTP METHOD="Post"
URL="http://www.thatsite.com/search.exe"
RESOLVEURL="Yes">
<CFHTTPPARAM TYPE="Formfield"
NAME="search"
VALUE="hello">
</CFHTTP>
<CFOUTPUT>
#CFHTTP.MimeType#<BR>
Length: #len(cfhttp.filecontent)# <BR>
Content: #htmlcodeformat(cfhttp.filecontent)#<BR>
</CFOUTPUT>
3. Save the file as getcgivars.cfm in myapps under your Web root directory.