Whatever message this page gives is out now! Go check it out!
<head> <title>HTTP Post Test</title> </head> <body> <h1>HTTP Post Test</h1> <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@adobe.com" name="emailaddress"> <cfhttpparam type="File" name="myfile" file="c:\pix\trees.gif"> </cfhttp> <cfoutput> File Content:<br> #cfhttp.filecontent#<br> Mime Type:#cfhttp.MimeType#<br> </cfoutput> </body> </html> |
Code | 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 </> 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 tag in server.cfm. | |
| Display the MIME type of the created file. |
<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 | |
| Write the transferred document to a file on the server. You send the file using the 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. | |
| Output information. This page does not display the results. They are passed back to the posting page in its cfhttp.filecontent 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. | |
| Output the value of the CGI variable sent in the HTTP request. | |
| Output the Form variable sent in the HTTP request. You send the variable using the type="formField" attribute but the receiving page gets it as a Form variable. | |
| Output the results of the cffile tag on this page. This time, the variables really are File variables. |
url="http://www.my_favorite_site.com/search.exe" resolveurl="Yes"> <cfhttpparam type="Formfield" name="search" value="ColdFusion"> </cfhttp> <cfoutput> Response Mime Type: #cfhttp.MimeType#<br> Response Length: #len(cfhttp.filecontent)# <br> Response Content: <br> #htmlcodeformat(cfhttp.filecontent)#<br> </cfoutput> |