Skip to content

libcURL.MultipartForm.FormAdd

Andrew Lambert edited this page Mar 15, 2017 · 8 revisions

#libcURL.MultipartForm.FormAdd

Method Signature

 Protected Function FormAdd(Option As Integer, Value As String, Option1 As Integer = CURLFORM_END, Value1 As String = "", Option2 As Integer = CURLFORM_END, Value2 As String = "", Option3 As Integer = CURLFORM_END, Value3 As String = "", Option4 As Integer = CURLFORM_END, Value4 As String = "", Option5 As Integer = CURLFORM_END, Value5 As String = "") As Boolean

Parameters

Name Type Comment
Option Integer A curlform option number.
Value String The value of the option number.
Option[1-5] Integer Optional. If specified, a curlform option number.
Value[1-5] String Optional. If specified, the value of the Option[1-5] 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 6 pairs of arguments may be passed at once. Refer the to the libcURL documentation for details.

See also

Clone this wiki locally