CURL.FormAddKeyValueContentType
-------------------------------

Add a section to a multipart/formdata HTTP POST.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.FormAddKeyValueContentType"; curl; Name; Value { ; ContentType; ContentHeaders } ) 

**MBS**( **"CURL.FormAddKeyValueContentType";** /\* Add a section to a multipart/formdata HTTP POST. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Name**; /\* The name of the form field.e.g. "city" \*/   
**$Value**; /\* The value for the form field.e.g. "&lt;html&gt;&lt;/html&gt;" \*/   
**$ContentType**; /\* Optional; The mime content type for this field.e.g. "text/html" \*/   
**$ContentHeaders**) /\* Optional; List of headers to include.e.g. "Content-Id: 12345" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| curl | The CURL session handle. | $curl |  |
| Name | The name of the form field. | "city" |  |
| Value | The value for the form field. | "&lt;html&gt;&lt;/html&gt;" |  |
| ContentType | The mime content type for this field. | "text/html" | Optional |
| ContentHeaders | List of headers to include. | "Content-Id: 12345" | Optional      Added in version **10.3**. |

### Result

Returns "OK" or error code.

### Description

Add a section to a multipart/formdata HTTP POST.  
This adds simply form field with a given name and value.  
For text encoding UTF-8 is used here.  
  
Please call [CURL.FormFinish](CURLFormFinish.md) after you added all your fields and before you call [CURL.Perform](CURLPerform.md).  
You can use [Text.FileExtensionToMimeType](TextFileExtensionToMimeType.md) to find the content type for a file extension.  
Starting with version 10.3, this is the same function as [CURL.FormAddKeyValue](CURLFormAddKeyValue.md).  
### Examples

Sets comment field with text file:

 MBS ("CURL.FormAddKeyValueContentType"; $curl ; "Comment"; "Hello World"; "text/plain")  
### See also

- [CURL.FormAddKeyContainerContentType](CURLFormAddKeyContainerContentType.md)
- [CURL.FormAddKeyFileContentType](CURLFormAddKeyFileContentType.md)
- [CURL.FormAddKeyTextContentType](CURLFormAddKeyTextContentType.md)
- [CURL.FormAddKeyValue](CURLFormAddKeyValue.md)
- [CURL.FormFinish](CURLFormFinish.md)
- [CURL.Perform](CURLPerform.md)
- [Text.FileExtensionToMimeType](TextFileExtensionToMimeType.md)

This function checks for a license.

Created 18th August 2014 , last changed 14th May 2020

  
[CURL.FormAddKeyValue](CURLFormAddKeyValue.md) - [CURL.FormClear](CURLFormClear.md)

[HTML Version](CURLFormAddKeyValueContentType.shtml)