0
似乎curl只上傳10個字節。 $ url是正確的,$文件路徑也是正確的,並且文件存在!PHP捲曲上傳似乎只發送10個字節?
我有這樣的代碼:
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
"id" => $id,
"api_key" => $api_key,
"file" => "@".$_SERVER['DOCUMENT_ROOT']."/".$file
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
你怎麼知道它只上傳10個字節?您是否在監視傳出數據包以查看實際通過HTTP發送的內容?什麼var_dump(curl_getinfo($ ch));顯示? – drew010