这是我邮递员的卷曲代码:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "2403",
CURLOPT_URL => "http://".cfg('api_ip')."/sk_group/update_profile_pic",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n{\"groupId\":\"Group|1\",\"profile_pic\":\"image.jpg\"}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"profile_pic\"; filename=\"image.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"sessionid: 876523451721001",
"versioncode: 1"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
如何将输入文件中的文件发送到post字段中的profile_pic?我已经在Google中搜索了很多次,但是我还没有做过,任何知道如何的人..请帮助我...
仅收到响应错误curl来自服务器的空回复
如果文件已发布..,则服务器上的文件始终为0kb大小