2017-09-26 8 views
0

uploadFile 메소드를 사용하여 zoho에 파일을 업로드하고 싶지만, 불행히도 다음과 같은 메시지가 나타납니다.Zoho API 파일 업로드 오류 "요청을 처리 할 수 ​​없습니다. 올바른 파일을 제공했는지 확인하십시오."

"요청을 처리 할 수 ​​없습니다. 올바른 메소드 이름, 매개 변수 및 매개 변수 값을 입력했는지 확인하십시오."

$fields = array(); 
$fields['authtoken'] = $this->authtoken; 
$fields['scope'] = "crmapi"; 
$fields['id'] = $id; 
$fields['content'] = '@' . $content; 
$ffilesize = filesize($content); 
if ($ffilesize > 20000000) 
{ 
    die("File size must be less than 20MB"); 
} 


$zoho_url = "https://crm.zoho.com/crm/private/xml/$module/uploadFile"; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); 
curl_setopt($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt($ch, CURLOPT_POST, count($fields)); 
@curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); 
$output = curl_exec($ch); 
if ($err = curl_error($ch)) return $err; 
curl_close($ch); 
if($this->isError($output)){ 
    echo $this->error; 
} 
return $output; 

답변

1

는 설정으로 이동하십시오 조호에서 제공하는이 과정 ... -> 확장 & API를 -> API를 -> CRM의 API -> 기어 아이콘을 클릭 -> 인증 토큰 재생 . 이제 새로 생성 된 인증 토큰을 사용하여 API 호출을 시작하십시오.

조호 포럼 링크 : Zoho CRM->Zoho CRM Developer APIs

편집 : 마지막으로 가지고 솔루션 :

것은 변화 할 필요가 : -

$post['content'] = '@' . $content; 

$post['content'] = new CurlFile($content); 
+0

그것은 나를 위해 일입니다 전에. 하지만 현재는 그렇지 않습니다. –

+0

누구나 다른 해결책을 가지고 있습니다 ... –

+0

그것이 작동하지 않는다면, 왜 당신은 자신의 질문에 오답으로 대답 했습니까? – user10089632