User Guide

Table Of Contents
Using the cfhttp Post method 997
Reviewing the code
The following table describes the code and its function:
To view the variables:
1.
Create a ColdFusion page with the following content:
<html>
<head><title>HTTP Post Test</title> </head>
<body>
<h1>HTTP Post Test</h1>
<cffile destination="C:\temp\"
nameconflict="Overwrite"
filefield="Form.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.emailaddress#. <br>
The file was uploaded to #File.ServerDirectory#\#File.ServerFile#.
</cfoutput>
</body>
</html>
Code Description
<cfhttp method="Post"
url="http://127.0.0.1:8500/myapps/
post_test_server.cfm">
Post an HTTP request to the specified page.
<cfhttpparam type="Cookie"
value="cookiemonster"
name="mycookie6">
Send a cookie in the request.
<cfhttpparam type="CGI"
value="cgivar "
name="mycgi">
Send a CGI variable in the request.
<cfhttpparam type="URL"
value="theurl"
name="myurl">
Send a URL in the request.
<cfhttpparam type="Formfield"
value="twriter@macromedia.com"
name="emailaddress">
Send a Form field in the request.
<cfhttpparam type="File"
name="myfile"
file="c"\pix\trees.gif">
Send a file in the request.
The
</cfhttp> tag ends the http request.
<cfoutput>
File Content:<br>
#cfhttp.filecontent#<br>
Display the contents of the file that the page that is
posted to creates by processing the request. In this
example, this is the output from the
cfoutput tag in
server.cfm.
Mime Type: #cfhttp.MimeType#<br>
</cfoutput>
Display the MIME type of the created file.