MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 813

Developing coldfusion mx applications
Table of Contents

Advertisement

Replace the path to the GIF file to a path on your server (just before the closing
2
Save the file as post_test.cfm in the myapps directory under your web_root.
3
Note: You must write a page to view the variables. This is the next procedure.
Reviewing the code
The following table describes the code and its function:
Code
<cfhttp method="Post"
url="http://127.0.0.1:8500/myapps/
post_test_server.cfm">
<cfhttpparam type="Cookie"
value="cookiemonster"
name="mycookie6">
<cfhttpparam type="CGI"
value="cgivar "
name="mycgi">
<cfhttpparam type="URL"
value="theurl"
name="myurl">
<cfhttpparam type="Formfield"
value="twriter@macromedia.com"
name="emailaddress">
<cfhttpparam type="File"
name="myfile"
file="c"\pix\trees.gif">
<cfoutput>
File Content:<br>
#cfhttp.filecontent#<br>
Mime Type:
#cfhttp.MimeType#<br>
</cfoutput>
To view the variables:
Create a ColdFusion page with the following content:
1
<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>
Description
Post an HTTP request to the specified page.
Send a cookie in the request.
Send a CGI variable in the request.
Send a URL in the request.
Send a Form field in the request.
Send a file in the request.
The </cfhttp> tag ends the http request.
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
server.cfm.
Display the MIME type of the created file.
Using the cfhttp Post method
tag).
cfhttp
tag in
cfoutput
813

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents