CURL.FormAddKeyTextContentType
------------------------------

Add a section to a multipart/formdata HTTP POST.

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

MBS( "CURL.FormAddKeyTextContentType"; curl; Name; FileName; Text { ; Encoding; ContentType; ContentHeaders } ) 

**MBS**( **"CURL.FormAddKeyTextContentType";** /\* Add a section to a multipart/formdata HTTP POST. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Name**; /\* The name of the form field.e.g. "city" \*/   
**$FileName**; /\* The file name for this file.e.g. "test.txt" \*/   
**$Text**; /\* The text for the text file.e.g. "Hello World" \*/   
**$Encoding**; /\* Optional; The text encoding.  
Default is native until version 10.1, UTF-8 from 10.2 on.e.g. UTF8 \*/   
**$ContentType**; /\* Optional; The content type for this file.e.g. "text/plain" \*/   
**$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" |  |
| FileName | The file name for this file. | "test.txt" |  |
| Text | The text for the text file. | "Hello World" |  |
| Encoding | The text encoding.   Default is native until version 10.1, UTF-8 from 10.2 on.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | UTF8 | Optional |
| ContentType | The content type for this file. | "text/plain" | 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 text file form field with a given name and value.  
  
Please call [CURL.FormFinish](CURLFormFinish.md) after you added all your fields and before you call [CURL.Perform](CURLPerform.md).  
Starting with version 10.3, this is the same function as [CURL.FormAddKeyText](CURLFormAddKeyText.md).  
### Examples

Add text file:

 MBS ("CURL.FormAddKeyTextContentType"; $curl ; "Attachment"; "test.txt"; "Hello World"; "UTF-8"; "text/plain")  
Add PDF container:

 Set Variable \[ $r ; Value: MBS ( "[CURL.FormAddKeyContainerContentType](CURLFormAddKeyContainerContentType.md)"; $curl ; "file"; "document.pdf"; Test::MyContainer ; "application/pdf") \]  
Set Variable \[ $r ; Value: MBS ( "[CURL.FormFinish](CURLFormFinish.md)"; Handle ) \]  
### See also

- [CURL.FormAddKeyContainer](CURLFormAddKeyContainer.md)
- [CURL.FormAddKeyContainerContentType](CURLFormAddKeyContainerContentType.md)
- [CURL.FormAddKeyFileContentType](CURLFormAddKeyFileContentType.md)
- [CURL.FormAddKeyText](CURLFormAddKeyText.md)
- [CURL.FormAddKeyValueContentType](CURLFormAddKeyValueContentType.md)
- [CURL.FormFinish](CURLFormFinish.md)
- [CURL.Perform](CURLPerform.md)

### Release notes

- **Version 10.2**
    - Changed [CURL.FormAddKeyText](https://www.mbsplugins.eu/CURLFormAddKeyText.shtml) and [CURL.FormAddKeyTextContentType](https://www.mbsplugins.eu/CURLFormAddKeyTextContentType.shtml) to use UTF-8 as default encoding.

### Example Databases

- [CURL/CURL Send Form](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Send%20Form.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 10.2pr6](https://www.mbsplugins.de/archive/2020-05-04/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.6pr6](https://www.mbsplugins.de/archive/2012-03-12/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[CURL.FormAddKeyText](CURLFormAddKeyText.md) - [CURL.FormAddKeyValue](CURLFormAddKeyValue.md)

[HTML Version](CURLFormAddKeyTextContentType.shtml)