Please tell me how to transfer a file using curl post without php warning that $ data_curl is an array PHP Notice: Array to string conversion...
$data_curl = array('domain' => $domain, 'token' => '*', 'files' => array());
foreach ($_FILES["files"]["tmp_name"] as $file) {
$tmpfile = $_FILES['files']['tmp_name'][$i];
$filename = $name_file."_".time().".".$type;
$data_curl = $data_curl + array(
'file'.$i => curl_file_create($tmpfile, $_FILES['files']['type'][$i], $filename)
);
$i++;
}
$ch = curl_init('https://google.com');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_curl);
curl_exec($ch);
json_encode
and http_build_query
do not send file.