$tmp) { $multipart[] = [ 'name' => 'photos', 'contents' => fopen($tmp, 'r'), 'filename' => $files['name'][$i], ]; } curl_setopt($c, CURLOPT_POSTFIELDS, $multipart); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $res = curl_exec($c); $http = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); return $http < 400 ? json_decode($res, true) : null; } ?>