The following example 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.
Sample file: posttest.cfm
<CFHTTP METHOD="Post"
URL="http://housebeat/cfdocs/server.cfm"
USERNAME="user1"
PASSWORD="user1pwd">
<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="wbfreuh@allaire.com"
NAME="emailaddress">
<CFHTTPPARAM TYPE="File"
NAME="myfile"
FILE="c:\temp\cyberlogo.gif">
</CFHTTP>
<CFOUTPUT>
#CFHTTP.filecontent#
#CFHTTP.mimetype#
</CFOUTPUT>
Sample file: server.cfm
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>
This example uses the CFFILE tag to upload the contents of the file variable to c:\temp\junk.
|