[php-src] Issue #15859: cURL - Send 2+ files using the same parameter name ("file[]")
| From: | ghnp5 | Date: | Thu, 12 Sep 2024 16:11:01 +0000 |
| Subject: | [php-src] Issue #15859: cURL - Send 2+ files using the same parameter name ("file[]") | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247765@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15859
Author: ghnp5
### Description
The pull request https://github.com/php/php-src/pull/8292 made it
possible to send an array of parameters of the same name.
However, it doesn't seem to support files:
I'm using PHP 8.3, but I'm not succeeding in doing this:
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: multipart/form-data'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => [
new CURLFile($file1, posted_filename: 'File1.jpg'),
new CURLFile($file2, posted_filename: 'File2.jpg')
]
]);
> PHP Fatal error: Uncaught Error: Object of class CURLFile could not be converted to string
Would it be possible to fix this, please? 😊
Thank you very much!