Adobe COLDFUSION 9 Manual page 1244

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
Code
<cfhttpparam type="File" name="myfile"
file="c"\pix\trees.gif">
<cfoutput>
File Content:<br>
#cfhttp.filecontent#<br>
Mime Type: #cfhttp.MimeType#<br>
</cfoutput>
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>
Replace C:\temp\ with an appropriate directory path on your hard drive.
2
Save the file as post_test_server.cfm in the myapps directory under your web_root.
3
4
View post_test.cfm in your browser and look for the file in C:\temp\ (or your replacement path).
Reviewing the code
The following table describes the code and its function:
Code
<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.mycookie# <br>
Description
Send a file in the request.
The
</>
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, the contents is the output
from the
cfoutput
Display the MIME type of the created file.
Description
Write the transferred document to a file on the server. You send the
file using the
type="File"
a Form variable, not a File variable. This cffile tag creates File variables,
as follows.
Output information. This page does not display the results. They are
passed back to the posting page in its
variable.
Output the value of the URL variable sent in the HTTP request.
Output the value of the Cookie variable sent in the HTTP request.
Last updated 8/5/2010
tag in server.cfm.
attribute, but the receiving page gets it as
cfhttp.filecontent
1239

Advertisement

Table of Contents
loading

Table of Contents