post file

php curl POST Отправка файла, пример работы с CURLFile

// $file_path - путь к файлу, напр. созданному во временной папке
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$cfile = new \CURLFile($file_path, 'image/jpeg', 'test_name');
$data = ['file' => $cfile];
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 1000);
$proxy = 'адресПрокси';  // если нужен прокси
curl_setopt($ch, CURLOPT_PROXY, $proxy); // если нужен прокси
$output = curl_exec_with_stat($ch);
if (curl_errno($ch)) {
Subscribe to RSS - post file