写真付きのユーザーを作成するために Appcelerator Cloud をリクエストしようとしていますが、ユーザーは写真なしで作成されていますが、リクエスト付きの写真を添付すると、このエラーが発生します このコードはエラー "{ "meta": { "status" : "fail", "code": 400, "message": "写真のアップロードに失敗しました: 写真ファイルの識別に失敗しました" } }"
Please Help me with this , i m new to PHP
<?php
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7";
$data = json_encode(array(
'securitycode' => $_POST['code'],
'designation' => $_POST['desi'],
'comapanyname' => $_POST['cname'],
'companylogoid' => $_POST['clogoid'],
'companyurl' => $_POST['curl'],
'location' => $_POST['location'],
'emailprivateflag' => $_POST['emailp'],
'linkedinurl' => $_POST['linkedin'],
'twitterhandle' => $_POST['twitter'],
'isspeaker' => $_POST['isspeaker'],
'allowaccess' => $_POST['access']
));
//$photo = array('photo' => '@' . $_FILES['file']['name'][0]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.cloud.appcelerator.com/v1/users/login.json?key=LJOVi9A95Y3r6TqlFmxS314v6ox4xaPf");
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie1.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie1.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,"login=test@test.com&password=test");
// $html=curl_exec($ch);
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL,"https://api.cloud.appcelerator.com/v1/users/create.json?key=LJOVi9A95Y3r6TqlFmxS314v6ox4xaPf");
curl_setopt($ch1, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch1, CURLOPT_HTTPHEADER, Array('Content-Type: multipart/form-data',"Accept: */*"));
// curl_setopt($ch1, CURLOPT_COOKIEFILE,'cookie2.txt');
// curl_setopt($ch1, CURLOPT_COOKIEJAR, 'cookie2.txt');
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch1, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch1, CURLOPT_POST, true);
curl_setopt($ch1, CURLOPT_POSTFIELDS, 'email='.$_POST['email'].'&first_name='.$_POST['fname'].'&last_name='.$_POST['lname'].'&password=ciosummit&password_confirmation=ciosummit&photo=@'. $_FILES['file']['tmp_name'][0].'&custom_fields='.$data);
$html=curl_exec($ch1);
header('Location:index.php?status='. rawurlencode($html));
//echo $html;
?>