#php: curl file with text param
<?php
$args = array('name' => 'hehe', 'age' => 20));
$args['file'] = new CurlFile(realpath('download.jpg'), 'image/jpg');
//curl_file_create('download.jpg', 'application/octet-stream', realpath('download.jpg'));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
Comments