Skip to content

libcURL.MultipartForm.FormAdd

Andrew Lambert edited this page Nov 26, 2022 · 8 revisions

Method Signatures

 Function FormAdd(Option As Integer, Value As Variant, Option1 As Integer = CURLFORM_END, Value1 As Variant = Nil, Option2 As Integer = CURLFORM_END, Value2 As Variant = Nil, Option3 As Integer = CURLFORM_END, Value3 As Variant = Nil, Option4 As Integer = CURLFORM_END, Value4 As Variant = Nil, Option5 As Integer = CURLFORM_END, Value5 As Variant = Nil, Option6 As Integer = CURLFORM_END, Value6 As Variant = Nil, Option7 As Integer = CURLFORM_END, Value7 As Variant = Nil, Option8 As Integer = CURLFORM_END, Value8 As Variant = Nil, Option9 As Integer = CURLFORM_END, Value9 As Variant = Nil, Option10 As Integer = CURLFORM_END, Value10 As Variant = Nil) As Boolean
 Protected Function FormAdd(Options() As Integer, Values() As Variant) As Boolean

Parameters

Name Type Comment
Option Integer A curlform option number.
Value Variant The value of the option number.
Option[1-10] Integer Optional. If specified, a curlform option number.
Value[1-10] Variant Optional. If specified, the value of the Option[1-10] number.

Return value

Returns True if the operation succeeded. Check MultipartForm.LastError for the error number if this method returns False.

Remarks

This helper function is a wrapper for the variadic external method curl_formadd. Since external methods can't be variadic, this method simulates it by accepting a finite number of optional arguments.

Each form field is passed as (at least) four arguments: two Option/Value arguments each for the name and contents of the form field. For example, a form with a username field and password field:

 Call FormAdd( _
    CURLFORM_COPYNAME, "username", CURLFORM_COPYCONTENTS, "Bob", _
    CURLFORM_COPYNAME, "password", CURLFORM_COPYCONTENTS, "seekrit")

At least 1 and up to 11 pairs of arguments may be passed at once. Refer the to the libcURL documentation for details.

See also

Clone this wiki locally