curl_file_create関数を使用するパターン。
<?php $ch = curl_init('https://api.example.com/image'); $cfile = curl_file_create('item.jpg', 'image/jpeg', 'item'); $data = array('image_file' => $cfile); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch)