diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /bin/wiki/vendor/addwiki/mediawiki-api-base/docs/multipart.rst |
first commit
Diffstat (limited to 'bin/wiki/vendor/addwiki/mediawiki-api-base/docs/multipart.rst')
-rw-r--r-- | bin/wiki/vendor/addwiki/mediawiki-api-base/docs/multipart.rst | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/wiki/vendor/addwiki/mediawiki-api-base/docs/multipart.rst b/bin/wiki/vendor/addwiki/mediawiki-api-base/docs/multipart.rst new file mode 100644 index 00000000..1b438c71 --- /dev/null +++ b/bin/wiki/vendor/addwiki/mediawiki-api-base/docs/multipart.rst @@ -0,0 +1,28 @@ +================== +Multipart requests +================== + +The MultipartRequest class can be used if you need a FluentRequest that has more parameters to be set on individual parts of a multipart request. + +The name is a slight misnomer, because either of the other two Request classes (SimpleRequest and FluentRequest) +will also end up being multipart requests if you pass any parameters of type Resource_. + +.. _Resource: http://php.net/manual/en/resource.php + +To use a MultipartRequest you must first set the main parameters, and then you can add additional "multipart parameters" to any of the parameters you've set. +(You will get an Exception if you try to set a multipart parameter for a main parameter that doesn't exist yet.) + +For example, to add a ``Content-Disposition`` header to a parameter named ``param1``:: + + $contentDisposition = 'form-data; name="param1"; filename="a_filename.png"'; + $request = MultipartRequest::factory() + ->setParams( [ 'param1' => 'Lorem ipsum' ] ) + ->setAction( 'actionname' ) + ->setMultipartParams( [ + 'param1' => [ + 'headers' => [ 'Content-Disposition' => $contentDisposition ], + ], + ] ); + $response = $api->postRequest( $request ); + +(For details of creating the ``$api`` object in this example, see :ref:`quickstart`.) |