Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  

CURL.FormAddKeyContainerContentType

Add a section to a multipart/formdata HTTP POST.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 2.6 Yes Yes Yes Yes Yes

MBS( "CURL.FormAddKeyContainerContentType"; Handle; name; filename; container; ContentType )

Parameters

Parameter Description Example value
Handle 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"

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.

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 [$r; Value:MBS("Trace")]
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.SetOptionVerbose"; $curl; 1)]
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("String.ReplaceNewline"; MBS("CURL.GetDebugAsText"; $curl);1)]
Set Variable [$result; Value:MBS("String.ReplaceNewline"; MBS("CURL.GetResultAsText"; $curl);1)]
Set Field [Donor Docs::ResultTextPost; $result]

See also


CURL.FormAddKeyContainer   -   CURL.FormAddKeyFile

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins