From 2f8139ca5ef506aafe88b01fbcd7c2a44d0f4a43 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 31 Jul 2024 12:04:02 +0900 Subject: [PATCH 1/3] docs: add links to sections --- user_guide_src/source/libraries/curlrequest.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/curlrequest.rst b/user_guide_src/source/libraries/curlrequest.rst index b33fad802f4a..d50620d22b49 100644 --- a/user_guide_src/source/libraries/curlrequest.rst +++ b/user_guide_src/source/libraries/curlrequest.rst @@ -260,7 +260,7 @@ if it's not already set: .. literalinclude:: curlrequest/024.php -.. note:: ``form_params`` cannot be used with the ``multipart`` option. You will need to use one or the other. +.. note:: ``form_params`` cannot be used with the `multipart`_ option. You will need to use one or the other. Use ``form_params`` for ``application/x-www-form-urlencoded`` request, and ``multipart`` for ``multipart/form-data`` requests. @@ -312,7 +312,7 @@ has been disabled. Any files that you want to send must be passed as instances o .. literalinclude:: curlrequest/028.php -.. note:: ``multipart`` cannot be used with the ``form_params`` option. You can only use one or the other. Use +.. note:: ``multipart`` cannot be used with the `form_params`_ option. You can only use one or the other. Use ``form_params`` for ``application/x-www-form-urlencoded`` requests, and ``multipart`` for ``multipart/form-data`` requests. From ceb26a5e95a6b595ab78bc4c53f422ab702ed57d Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 31 Jul 2024 12:04:35 +0900 Subject: [PATCH 2/3] docs: add empty line for readability --- user_guide_src/source/libraries/curlrequest.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/curlrequest.rst b/user_guide_src/source/libraries/curlrequest.rst index d50620d22b49..1e06b69cc484 100644 --- a/user_guide_src/source/libraries/curlrequest.rst +++ b/user_guide_src/source/libraries/curlrequest.rst @@ -306,8 +306,10 @@ multipart ========= When you need to send files and other data via a POST request, you can use the ``multipart`` option, along with -the `CURLFile Class `_. The values should be an associative array -of POST data to send. For safer usage, the legacy method of uploading files by prefixing their name with an `@` +the `CURLFile Class `_. + +The values should be an associative array +of POST data to send. For safer usage, the legacy method of uploading files by prefixing their name with an ``@`` has been disabled. Any files that you want to send must be passed as instances of CURLFile: .. literalinclude:: curlrequest/028.php From a2dffb32db3b8b0a644a2a5c32b211791827897c Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 31 Jul 2024 12:04:58 +0900 Subject: [PATCH 3/3] docs: improve sample code --- user_guide_src/source/libraries/curlrequest/028.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/libraries/curlrequest/028.php b/user_guide_src/source/libraries/curlrequest/028.php index fcce227c1d9a..e56b96b127a5 100644 --- a/user_guide_src/source/libraries/curlrequest/028.php +++ b/user_guide_src/source/libraries/curlrequest/028.php @@ -1,6 +1,8 @@ 'bar', - 'userfile' => new \CURLFile('/path/to/file.txt'), -]; +$client->request('POST', '/post', [ + 'multipart' => [ + 'foo' => 'bar', + 'userfile' => new \CURLFile('/path/to/file.txt'), + ], +]);