Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.FormAddKeyContainerContentType
Add a section to a multipart/formdata HTTP POST.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.6 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
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 |
ContentHeaders | Available in MBS FileMaker Plugin 10.3 or newer. List of headers to include. |
"Content-Id: 12345" | Optional |
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 after you added all your fields and before you call CURL.Perform.
Starting with version 10.3, this is the same function as CURL.FormAddKeyContainer.
Examples
Add file from container:
MBS("CURL.FormAddKeyContainerContentType"; $curl; "Attachment"; "paris.jpg"; Test::test; "image/jpeg")
Use netverify.com to check a driver license:
#Setup transfer
Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "https://netverify.com/api/netverify/v2/fastfill")]
Set Variable [$result; Value:MBS("CURL.SetOptionVerbose"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; "25D63FB16966473DA2416454FD468BBD")]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; "4356789038498914948018924658901622")]
Set Variable [$result; Value:MBS("CURL.SetOptionHTTPHeader"; $curl; "Accept: application/json"; "Expect:")]
Set Variable [$metadata; Value:"{\"type\": \"DRIVING_LICENSE\",\"country\": \"USA\"}"]
Set Variable [$r; Value:MBS("CURL.FormAddKeyValue";$curl; "metadata"; $metadata)]
Set Variable [$r; Value:MBS("CURL.FormAddKeyContainerContentType";$curl; "backsideImage"; "test.jpg"; Donor Docs::DocPDF; "image/jpeg")]
Set Variable [$r; Value:MBS("CURL.FormFinish";$curl)]
#Run transfer
Set Field [Donor Docs::ResultCodePost; MBS("CURL.Perform"; $curl)]
#Check result
Set Field [Donor Docs::DebugTextPost; MBS("CURL.GetDebugMessages"; $curl)]
Set Variable [$result; Value: MBS("CURL.GetResultAsText"; $curl)]
Set Field [Donor Docs::ResultTextPost; $result]
See also
- CURL.FormAddKeyContainer
- CURL.FormAddKeyFileContentType
- CURL.FormAddKeyValue
- CURL.GetResultAsText
- CURL.New
- CURL.Perform
- CURL.SetOptionPassword
- CURL.SetOptionURL
- CURL.SetOptionUserName
- CURL.SetOptionVerbose
Example Databases
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 14th May 2020