Issue
How do I upload multiple files in an array using CURLFile
and curl_setopt
?
Using the data array as it would throw an error (can't convert an array to a string) and http_build_query
on the data would corrupt the CURLFile
objects.
The data I have to upload looks like that:
[
'mode' => 'combine',
'input' => 'upload',
'format' => $outputformat,
'files' => [
[0] => CURLFile object,
[1] => CURLFile object,
[x] => ...
]
]
Solution
The index is part of the key
[
'mode' => 'combine',
'input' => 'upload',
'format' => $outputformat,
'files[0]' => CURLFile object,
'files[1]' => CURLFile object,
'files[x]' => CURLFile object
...
]
]
Answered By - jpanqueva Answer Checked By - Cary Denson (WPSolving Admin)