Skip to content

libcURL.MultipartForm

Andrew Lambert edited this page Nov 4, 2017 · 27 revisions

libcURL.MultipartForm

Class Declaration

 Protected Class MultipartForm
 Inherits libcURL.cURLHandle

Remarks

This class represents a linked list of form elements that is managed by libcURL. Use the AddElement method to add an element to the form. Form elements contents may be either a string, a Ptr to a memory buffer, a FolderItem, or an object which implements the Readable interface.

Once the MultipartForm is constructed you can pass it to the EasyHandle.SetFormData method, or to the EasyHandle.SetOption method using libcURL.Opts.HTTPPOST as the option number. Form elements may also contain nested forms, but you must use the FormAdd method to construct them.

e.g.

Dim frm As New libcURL.MultipartForm
Call frm.AddElement("username", "Bob")
Call frm.AddElement("fileupload", SpecialFolder.Desktop.Child("foo.bin"))
Dim curl As New libcURL.EasyHandle
Call curl.SetOption(libcURL.Opts.HTTPPOST, frm)
Call curl.Perform("http://www.example.com/submit.php", 5)

You may also convert a Dictionary into a new MultipartForm. If you pass a Dictionary to a method that expects a MultipartForm, then the Dictionary will be converted automatically.

You must maintain a reference to this object for the entire duration of all associated transfers. If the object goes out of scope and is destroyed then the underlying memory allocated by libcURL will be freed; doing this while libcURL is still using it will lead to failure.

Event Definitions

Methods

Shared methods

Clone this wiki locally