Sets the type of Form POST formatting that is used when calling AddPostKey() when posting key value pairs (ie. like HTML Form POST operations).

For all other raw buffer data like JSON or XML or binary files passed use the cContentTypeProperty instead.

Form POST Value Encoding

When values are POSTed to a server they typically require encoding, using either UrlEncoded or Multipart encoding when key value pairs are sent. This flag properly encodes values as they are POSTed. The default behavior is UrlEncoded format which is the same as used by typical HTML forms on HTML pages. Multipart encoding typically is used with binary data and file uploads.

Value Description Content Type
1 Form Url Encoded (standard POST operation) (Default) application/x-www-form-urlencoded
2 Multipart forms (file uploads) multipart/form

Note that these flag values also set the HTTP request's Content-Type header. The HTTP Content-Type header can also be explicitly set with the cContentType property.


This property must be set prior to calling AddPostKey()


*** POST to a standard HTML form
loHttp = CREATEOBJECT("wwHttp")

loHttp.nHttpPostMode = 1  && UrlEncode form vars

lcHtml = loHttp.HttpGet("http://somesite.com/loginform.wcsx")

*** Post to a multi-part form that includes a file (file upload)
loHttp = CREATEOBJECT("wwHttp")
loHttp.nHttpPostMode = 2  && multi-part / file

*** Upload a file
loHttp.AddPostKey("notes","sailing the seas of cheese")

lcHtml = loHttp.HttpGet("http://somesite.com/uploadform.wcsx")

See also:

West Wind Web Connection | wwHttp::AddPostKey | wwHttp::cContentType

© West Wind Technologies, 1996-2018 • Updated: 02/11/15
Comment or report problem with topic