CURL.FormAddKeyContainer
------------------------

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.FormAddKeyContainer"; curl; Name; FileName; Container { ; ContentType; ContentHeaders } ) 

**MBS**( **"CURL.FormAddKeyContainer";** /\* 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" \*/   
**$Container**; /\* The file content as a container value. Can be PDF, PNG, GIF, BMP, JPEG or other file content. \*/   
**$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" |  |
| Container | The file content as a container value. Can be PDF, PNG, GIF, BMP, JPEG or other file content. |  |  |
| ContentType | The content type for this file. | "text/plain" | Optional      Added in version **10.3**. |
| 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 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).  
### Examples

Add file from container:

 MBS ("CURL.FormAddKeyContainer"; $curl ; "Attachment"; "paris.jpg"; Test::test )  
Add SOAP request with MTOM attachment:

 Set Variable \[ $result ; Value: MBS ("[CURL.FormAddKeyText](CURLFormAddKeyText.md)"; $curl ; "request"; "&lt;soap:Envelope&gt;&lt;soap:Body&gt;&lt;tns:data&gt;&lt;xop:include href=\\"test.png\\"/&gt;&lt;/tns:data&gt;&lt;/soap:Body&gt; &lt;/soap:Envelope&gt;"; "text/xml") \]   
Set Variable \[ $result ; Value: MBS ("CURL.FormAddKeyContainer"; $curl ; "test"; "image.png"; Table::ContainerField ; "image/png"; "Content-Id: 1234") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.FormFinish](CURLFormFinish.md)"; $curl ) \]  
### See also

- [CURL.FormAddKeyContainerContentType](CURLFormAddKeyContainerContentType.md)
- [CURL.FormAddKeyText](CURLFormAddKeyText.md)
- [CURL.FormAddKeyTextContentType](CURLFormAddKeyTextContentType.md)
- [CURL.FormFinish](CURLFormFinish.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.SetOptionPassword](CURLSetOptionPassword.md)

### Release notes

- **Version 10.3**
    - Added ContentType and ContentHeaders parameter for [CURL.FormAddKeyContainer](https://www.mbsplugins.eu/CURLFormAddKeyContainer.shtml), [CURL.FormAddKeyFile](https://www.mbsplugins.eu/CURLFormAddKeyFile.shtml), [CURL.FormAddKeyText](https://www.mbsplugins.eu/CURLFormAddKeyText.shtml) and [CURL.FormAddKeyValue](https://www.mbsplugins.eu/CURLFormAddKeyValue.shtml).

### Blog Entries

- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr1](https://www.mbsplugins.de/archive/2020-06-01/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.FileInfos](CURLFileInfos.md) - [CURL.FormAddKeyContainerContentType](CURLFormAddKeyContainerContentType.md)

[HTML Version](CURLFormAddKeyContainer.shtml)