Skip to content

cURL - Send 2+ files using the same parameter name ("file[]") #15859

@ghnp5

Description

@ghnp5

Description

The pull request #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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy