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.
Содержание COLDFUSION 4.5-DEVELOPING WEB
Страница 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Страница 14: ...xiv Developing Web Applications with ColdFusion...
Страница 26: ...xxvi Developing Web Applications with ColdFusion...
Страница 34: ...8 Developing Web Applications with ColdFusion...
Страница 70: ...44 Developing Web Applications with ColdFusion...
Страница 84: ...58 Developing Web Applications with ColdFusion...
Страница 114: ...88 Developing Web Applications with ColdFusion...
Страница 148: ...122 Developing Web Applications with ColdFusion...
Страница 174: ...148 Developing Web Applications with ColdFusion...
Страница 208: ...182 Developing Web Applications with ColdFusion...
Страница 244: ...218 Developing Web Applications with ColdFusion...
Страница 274: ...248 Developing Web Applications with ColdFusion...
Страница 288: ...262 Developing Web Applications with ColdFusion...
Страница 300: ...274 Developing Web Applications with ColdFusion...
Страница 350: ...324 Developing Web Applications with ColdFusion...
Страница 362: ...336 Developing Web Applications with ColdFusion...