From 3c4175e312c527a04fab3edbc1014d4c5bd988ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=B6nsch?= Date: Sat, 4 Mar 2023 11:25:09 +0100 Subject: [PATCH 1/4] [HttpClient] support overwriting form encoding --- http_client.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/http_client.rst b/http_client.rst index 9081ed4df4a..98252a86039 100644 --- a/http_client.rst +++ b/http_client.rst @@ -627,6 +627,11 @@ according to the ``multipart/form-data`` content-type. The 'body' => $formData->bodyToIterable(), ]); +By default, :class:`Symfony\\Component\\Mime\\Part\\Multipart\\FormDataPart` +will transfer file uploads in binary encoding. But you can enforce Base64:: + + DataPart::fromPath('/path/to/uploaded/file', null, null, 'base64') + .. tip:: When using multidimensional arrays the :class:`Symfony\\Component\\Mime\\Part\\Multipart\\FormDataPart` From 412b71343734f787a93750caa26f3e2ea73a3192 Mon Sep 17 00:00:00 2001 From: croensch Date: Sat, 6 May 2023 15:13:10 +0200 Subject: [PATCH 2/4] fix semicolon and introduce helpful var --- http_client.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http_client.rst b/http_client.rst index 98252a86039..c5f0a70405e 100644 --- a/http_client.rst +++ b/http_client.rst @@ -630,7 +630,7 @@ according to the ``multipart/form-data`` content-type. The By default, :class:`Symfony\\Component\\Mime\\Part\\Multipart\\FormDataPart` will transfer file uploads in binary encoding. But you can enforce Base64:: - DataPart::fromPath('/path/to/uploaded/file', null, null, 'base64') + $fileField = DataPart::fromPath('/path/to/uploaded/file', null, null, 'base64'); .. tip:: From 01227097efd1e9d8e225af887b3259bdae0b75ba Mon Sep 17 00:00:00 2001 From: croensch Date: Sat, 13 May 2023 13:16:57 +0200 Subject: [PATCH 3/4] edited suggestions --- http_client.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/http_client.rst b/http_client.rst index c5f0a70405e..f0ac7ae4c92 100644 --- a/http_client.rst +++ b/http_client.rst @@ -630,7 +630,13 @@ according to the ``multipart/form-data`` content-type. The By default, :class:`Symfony\\Component\\Mime\\Part\\Multipart\\FormDataPart` will transfer file uploads in binary encoding. But you can enforce Base64:: - $fileField = DataPart::fromPath('/path/to/uploaded/file', null, null, 'base64'); + $fileField = DataPart::fromPath( + path: '/path/to/uploaded/file', + encoding: 'base64' + ); + +.. versionadded:: 6.3 + The `encoding` parameter was introduced in Symfony 6.3. .. tip:: From c5196d5db4cb0215da6998379fd6404a3ab75ebb Mon Sep 17 00:00:00 2001 From: croensch Date: Sat, 13 May 2023 13:42:54 +0200 Subject: [PATCH 4/4] Update http_client.rst --- http_client.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/http_client.rst b/http_client.rst index f0ac7ae4c92..2f8c9eb0c13 100644 --- a/http_client.rst +++ b/http_client.rst @@ -636,6 +636,7 @@ will transfer file uploads in binary encoding. But you can enforce Base64:: ); .. versionadded:: 6.3 + The `encoding` parameter was introduced in Symfony 6.3. .. tip::