Using the cfhttp Post Method
339
<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.emailaddress#. <br>
The file was uploaded to #File.ServerDirectory#\#File.ServerFile#.
</cfoutput>
3
Replace C:\temp\Junk with an appropriate directory path on your hard drive.
4
Save the file as
server.cfm
in
myapps
under your Web root directory.
5
View posttest.cfm in your browser and look for the file in C:\temp\Junk (or your
replacement path).
Reviewing the code
The following table describes the code and its function:
Code
Description
<cffile destination="C:\temp\Junk"
nameconflict="Overwrite"
filefield="Form.myfile"
action="Upload"
attributes="Normal">
Write the transferred document to a file on
the server. Note that you send the file
using the
cfhttpparam type="File"
attribute, but the receiving page gets it as
a Form variable, not a File variable. This
cffile
tag creates File variables, as
follows.
<cfoutput>
Output information. The results are not
displayed by this page. They are passed
back to the posting page in its
cfhttp.filecontent
variable.
The URL variable is: #URL.myurl# <br>
Output the value of the URL variable sent
in the HTTP request.
The Cookie variable is:
#Cookie.mycookie# <br>
Output the value of the Cookie variable
sent in the HTTP request.
The CGI variable is: #CGI.mycgi# <br>
Output the value of the CGI variable sent
in the HTTP request.
The Form variable is:
#Form.emailaddress#. <br>
Output the Form variable sent in the HTTP
request. Note that you send the variable
using the
type="formField"
attribute but
the receiving page gets it as a Form
variable.
The file was uploaded to
#File.ServerDirectory#\#File.
ServerFile#.
</cfoutput>
Output the results of the
cffile
tag on this
page. This time, the variables really are
File variables.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...