0
我試圖發送一些表單字段以及使用CURL在php中的多個文件,得到了下面的錯誤。在使用curl在php中發送文件的同時獲取錯誤
"Required Multipartfile parameter utterance is not present".
Below listed is the piece of code, I have used in my application.
$a1614_1 = "@" .realpath("RecordFiles/1614_1.wav");
$payload = array("sessionid"=>$sessionid,"clientid"=> $clientid,"userid"=>$userid,"utterance"=> $a1614_1,"type"=>$type,"action"=>$action);
$multipart_boundary = "ABC1234";
$request_headers = array();
$request_headers[] = "Content-Type: multipart/form-data; boundary=". $multipart_boundary;
$curl_options = array(
CURLOPT_URL => $base_api_url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($payload),
CURLOPT_HTTP_VERSION => 1.0,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_VERBOSE => true,
CURLOPT_HTTPHEADER => $request_headers
);
$curl = curl_init();
curl_setopt_array($curl, $curl_options);
$result = curl_exec($curl);
curl_close ($curl);
In my code i'm passing utterance as one of the multipart parameter but still i'm getting the same error. I have googled to resolve the problem but not able to fix it. Is there any problem in the above code approach, if any one have idea please share to me to fix or resolve the issue.
請幫助/協助我解決此問題。
感謝lot..i嘗試,它爲我的作品.. – user3223414
@ user3223414你可以把我的答案如果有幫助就接受。 – Dador