Skip to content

libcURL.MultipartForm.AddElement

Andrew Lambert edited this page Jun 15, 2017 · 30 revisions

Method Signatures

 Function AddElement(Name As String, Value As String) As Boolean
 Function AddElement(Name As String, Value As FolderItem, ContentType As String = "") As Boolean
 Function AddElement(Name As String, ValueStream As Readable, ValueSize As Integer, Filename As String = "", ContentType As String = "") As Boolean
 Function AddElement(Name As String, ByRef Value As MemoryBlock, Filename As String, ContentType As String = "") As Boolean

Parameters

AddElement(String, String)

Name Type Comment
Name String The name of the form element (i.e. the name attribute of the HTML <input> tag)
Value String The content of the element

AddElement(String, FolderItem, String)

Name Type Comment
Name String The name of the form element (i.e. the name attribute of the HTML <input> tag)
Value FolderItem The file to encode in the form
ContentType String Optional. The Content-Type of the file (e.g. text/html.)

AddElement(String, Readable, Integer, String, String)

Name Type Comment
Name String The name of the form element (i.e. the name attribute of the HTML <input> tag)
ValueStream Readable The stream from which to read the contents of the form element when they are actually needed.
ValueSize Integer The total number of bytes to read from ValueStream.
Filename String Optional. If specified then the form element is encoded as a file element.
ContentType String Optional. The Content-Type of the file (e.g. text/html.) This parameter is ignored if Filename is not specified.

AddElement(String, ByRef MemoryBlock, String, String)

Name Type Comment
Name String The name of the form element (i.e. the name attribute of the HTML <input> tag)
Value MemoryBlock A pointer to a memory block containing the value. Must remain valid for the duration of all transfers.
Filename String The file name to use. While not an optional parameter, you may pass the empty string if the element should not be encoded as a file element.
ContentType String Optional. The Content-Type of the file (e.g. text/html.) This parameter is ignored if Filename is the empty string.

Return value

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

Remarks

Pass a string to set a string element or a folderitem to set a file upload element. You may also pass a Readable object to have libcURL read from when the form element contents are needed, or a pointer to a memory buffer that already contains file data.

See also

Clone this wiki locally