Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
Statistic
FMM
Blog
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 |
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 |
Returns "OK" or error code.
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.GetDebugAsText"; $curl)]
Set Variable [$result; Value: MBS("CURL.GetResultAsText"; $curl)]
Set Field [Donor Docs::ResultTextPost; $result]
Created 18th August 2014, last changed 14th May 2020
CURL.FormAddKeyContainer - CURL.FormAddKeyFile
Feedback: Report problem or ask question.