Отправляю curl файл
/** @var /var/www/ksalfa/data/www/k.ru/admin/bank/files/40.jpg $data['file'] **/
$data = Array('document' => '@' . $data['file']); //путь абсолютный, файл есть
$headers[] = 'Cache-Control: no-cache';
$headers[] = 'Content-Type: multipart/form-data;';
$curlOptions[\CURLOPT_POST] = true;
$curlOptions[\CURLOPT_RETURNTRANSFER] = true;
$curlOptions[\CURLOPT_URL] = $uri;
$curlOptions[\CURLOPT_POSTFIELDS] = $data;
curl_setopt_array($curl, $curlOptions);
$response = curl_exec($curl); //URL верный
f (false === $response) {
$error = curl_error($curl);
$errorCode = curl_errno($curl);
die('Curl error: ' . $error. ' code: ' . $errorCode);
}
$httpCode = curl_getinfo($this->curl, \CURLINFO_HTTP_CODE);
return array($httpCode, $response);
php < 5.3
обновить пыху не вариант
Получаю ответ
HTTP Status [415] – [Unsupported Media Type]
Type Status Report
Description The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.
Apache Tomcat/9.0.0.M21

В доках сказано нужно
POST /part/api/v1/request/add?id=123456
Host: q.s-p.ru
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary8MA4Y
Cache-Control: no-cache
X-Auth-Token: token
X-Auth-User: base64user
------WebKitFormBoundary8MA4Y
Content-Disposition: form-data; name="document"; filename=""
Content-Type:
------WebKitFormBoundary8MA4Y--
Что я делаю не так?