Package: matlab.net.http.io
Superclasses: matlab.net.http.io.MultipartProvider
ContentProvider to send multipart/form-data messages
Use this provider to send a multipart form to the server. A multipart form is a message
containing a series of parts, where each part has a "control name" and its data. The data can
be any of the types allowed for RequestMessage.Body.Data
or another
ContentProvider
.
Some servers require multiple parts under the same name to be in a nested multipart/mixed
part. To send nested parts, wrap the parts in a MultipartProvider
. For example,
to send a message as described at the very end of chapter 17 of the HTML 4.01 specification
for form data:
fps = FileProvider(["file1.txt","file2.gif"]); % get array of providers mp = MultipartProvider(fps); formProvider = MultipartFormProvider("submit-name","Larry","files",mp); req = RequestMessage('put',[],formProvider); req.send(uri);
The matlab.net.http.io.MultipartFormProvider
class is a handle
class.
provider = MultipartFormProvider(
creates Name,Part
)"multipart/form-data"
content specified by one or more
name-part pair arguments. Part
is form-data containing a
Name
and its contents. The Part
arguments can be
any of the types supported by MultipartProvider
, including other
ContentProvider
objects.
If a Part
is an array, it is equivalent to repeating the
Name,Part
for each element of the array. For example, the
statement:
MultipartFormProvider("name",FileProvider(["file1" "file2"]))
is equivalent to:
MultipartFormProvider("name",FileProvider("file1"),"name",FileProvider("file2"));