Allowed inside cfhttp tag bodies only. Required for cfhttp POST
operations. Optional for all others. Specifies parameters to
build an HTTP request.

  <cfhttpparam type="header">


Attribute Reference

type string

The type of data to send

header: Specifies an HTTP header. Does not URL encode the value

body: Specifies that the value is the body of the HTTP request.

xml: Identifies the request as having a content-type of
text/xml and specifies that the value attribute contains the body of the HTTP request.

cgi: Same as header but URL encodes the value by default.

file: Tells CFML to send the contents of the specified file.

url: Specifies a URL query string name-value pair to append to the cfhttp url attribute. URL encodes the value.

formfield: Specifies a form field to send. URL encodes the value by default.

cookie: Specifies a cookie to send as an HTTP header. URL encodes the value.
  • header
  • body
  • xml
  • cgi
  • file
  • url
  • formfield
  • cookie

name string

Variable name for data that is passed. Ignored for body and xml type. For file type, specifies the filename.

value string

Value of the data that is sent. Ignored for file type. The value must contain string data or data that CFML can convert to a string for all type attributes except Body. Body types can have string or binary values.

file string

Applies to file type; ignored for all other types. The absolute path to the file that is sent with the request.

encoded boolean

Applies to formfield and cgi types; ignored for all other
types. Specifies whether to URLEncode the form field or
  • true
  • false

mimetype string

Applies to file type; invalid for all other types.
Specifies the MIME media type of the file contents.
The content type can include an identifier for the
character encoding of the file; for example, text/html;
charset=ISO-8859-1 indicates that the file is HTML text in
the ISO Latin-1 character encoding.
  • text/plain
  • text/html

Sample code using the cfhttpparam tag

cfhttp(method="POST", charset="utf-8", url="", result="result") {
    cfhttpparam(name="q", type="formfield", value="cfml");

httpService = new http(method = "POST", charset = "utf-8", url = "");
httpService.addParam(name = "q", type = "formfield", value = "cfml");
result = httpService.send().getPrefix();

<cfhttp result="result" method="POST" charset="utf-8" url="">
    <cfhttpparam name="q" type="formfield" value="cfml">
<cfdump var="#result#">

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub