function upload_resume_zoho_recruit() {
global $wpdb, $current_user;
$user_email = $current_user->user_email;
$key = get_option('zoho_recruit');
$token = $key['authtoken'];
$api_url = $key['api_url'];
$len = count($_FILES);
$header =['ENCTYPE: multipart/form-data','Content-Type:multipart/form-data;boundary='.(string)$current_time_long];// array('Content-Type: multipart/form-data');
$url = $api_url."/recruit/private/xml/Candidates/uploadFile";
$result = $wpdb->get_row("SELECT * FROM `candidates` WHERE `email` LIKE '".$user_email."'");
$id = $result->candidate_id;
if ($id != 0) {
$cFile = new CURLFile($_FILES['cvfile']['tmp_name'],$_FILES['cvfile']['type'],$_FILES['cvfile']['name']);
$param = array (
'authtoken' => $token,
'scope' => 'recruitapi',
'content' => $cFile,
'id' => $id,
'type' => 'CVR-aw'
);
$ch=curl_init();
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_VERBOSE,0);
curl_setopt($resource, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$param);
$response=curl_exec($ch);
//send email of API response
$to = $key['email_log'];
send_email($to, 'Zoho Recruit API Logs - uploadFile',$len.' '.$api_url.' '.json_encode($response),$user_email);
}
return json_decode($response);