I need to create files array for sending to curl. It works with postman with multiple files. My app it works only if I send only 1 file. But I get 400(bad request) error when I send files as an array.
I use this web servis for merging files. Can you help me, what is wrong with my php?
Curl file should be like this:
**CURLOPT_POSTFIELDS **=> array(‘files’=> new CURLFILE(‘postman-cloud:///1ef093ea-b5df-4aa0-8b36-13c1aaad7e17’),’files’=> new CURLFILE(‘postman-cloud:///1ef093ea-d5f4-48e0-b651-e5fd8820fb86’),’files’=> new CURLFILE(‘postman-cloud:///1ef093ea-d5f4-48e0-b651-e5fd8820fb86’)),
));
My php code is:
$files = array();
foreach ($fileTtable as $Id)
{
$files[] =array(‘files’=> new CURLFILE($originalFilepath[$Id]));
}
$this->dump($files);
Output is:
Array
( [0] => Array
( [files] => CURLFile Object
( [name] => uploads00/000/043/214/Nyilatkozat munkab_r utal_sr_l_1173.pdf [mime] => [postname] =>
)
)
[1] => Array
( [files] => CURLFile Object
( [name] => uploads00/000/043/212/zemorvosi beutal.pdf [mime] => [postname] =>
)
)
)
I send multiple files to curl and expect 1 merged file as a result.
Funda Aktan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.