File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
user_guide_src/source/libraries Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ if it's not already set:
260
260
261
261
.. literalinclude :: curlrequest/024.php
262
262
263
- .. note :: ``form_params`` cannot be used with the `` multipart`` option. You will need to use one or the other.
263
+ .. note :: ``form_params`` cannot be used with the `multipart`_ option. You will need to use one or the other.
264
264
Use ``form_params `` for ``application/x-www-form-urlencoded `` request, and ``multipart `` for ``multipart/form-data ``
265
265
requests.
266
266
@@ -306,13 +306,15 @@ multipart
306
306
=========
307
307
308
308
When you need to send files and other data via a POST request, you can use the ``multipart `` option, along with
309
- the `CURLFile Class <https://www.php.net/manual/en/class.curlfile.php >`_. The values should be an associative array
310
- of POST data to send. For safer usage, the legacy method of uploading files by prefixing their name with an `@ `
309
+ the `CURLFile Class <https://www.php.net/manual/en/class.curlfile.php >`_.
310
+
311
+ The values should be an associative array
312
+ of POST data to send. For safer usage, the legacy method of uploading files by prefixing their name with an ``@ ``
311
313
has been disabled. Any files that you want to send must be passed as instances of CURLFile:
312
314
313
315
.. literalinclude :: curlrequest/028.php
314
316
315
- .. note :: ``multipart`` cannot be used with the `` form_params`` option. You can only use one or the other. Use
317
+ .. note :: ``multipart`` cannot be used with the `form_params`_ option. You can only use one or the other. Use
316
318
``form_params `` for ``application/x-www-form-urlencoded `` requests, and ``multipart `` for ``multipart/form-data ``
317
319
requests.
318
320
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- $ post_data = [
4
- 'foo ' => 'bar ' ,
5
- 'userfile ' => new \CURLFile ('/path/to/file.txt ' ),
6
- ];
3
+ $ client ->request ('POST ' , '/post ' , [
4
+ 'multipart ' => [
5
+ 'foo ' => 'bar ' ,
6
+ 'userfile ' => new \CURLFile ('/path/to/file.txt ' ),
7
+ ],
8
+ ]);
You can’t perform that action at this time.
0 commit comments