PHP 通过 curl curl_file_create上传文件
$toUrl = 'https://www.baidu.com/image';
$data = array(
'title' => '上传文件',
'file' => curl_file_create($_FILES['file']['tmp_name'], $_FILES['file']['type'], $_FILES['file']['name']),
);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $toUrl );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data);
$return = curl_exec ( $ch );
curl_close ( $ch );