CURL.FormAddKeyFileContentType
------------------------------

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.FormAddKeyFileContentType"; curl; Name; Path { ; ContentType; ContentHeaders } ) 

**MBS**( **"CURL.FormAddKeyFileContentType";** /\* Add a section to a multipart/formdata HTTP POST. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Name**; /\* The name of the form field.e.g. "city" \*/   
**$Path**; /\* Native file path.e.g. "/Users/cs/Desktop/test.txt" \*/   
**$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" |  |
| Path | Native file path. | "/Users/cs/Desktop/test.txt" |  |
| 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 a file with the given key name into the form.  
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.FormAddKeyFile](CURLFormAddKeyFile.md).  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Add image file to form:

 MBS ("CURL.FormAddKeyFileContentType"; $curl ; "Attachment"; "/Users/cs/desktop/Paris.jpg"; "image/jpeg")  
### See also

- [CURL.FormAddKeyContainerContentType](CURLFormAddKeyContainerContentType.md)
- [CURL.FormAddKeyFile](CURLFormAddKeyFile.md)
- [CURL.FormAddKeyTextContentType](CURLFormAddKeyTextContentType.md)
- [CURL.FormAddKeyValueContentType](CURLFormAddKeyValueContentType.md)
- [CURL.FormFinish](CURLFormFinish.md)
- [CURL.Perform](CURLPerform.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Blog Entries

- [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.FormAddKeyFile](CURLFormAddKeyFile.md) - [CURL.FormAddKeyText](CURLFormAddKeyText.md)

[HTML Version](CURLFormAddKeyFileContentType.shtml)