unable to upload photo using jquery/ajax facebook graph api b'coz of formpost data error
i have a jquery-ajax call to php page that is supposed to upload user photos to users default album;but when call is made error occurs as
failed creating formpost data curl exception
here is the code of jquery ajax function and php script that uploads user photo:
jquery-ajax function:
$.ajax({
type: "GET",
url: "./page1.php",//link to php page
data: "link=" + lnk, //image path
success: function(msg){
alert('upd: '+msg);
},
error: function(msg){
alert('flt: '+msg);
}
});
php script (page1.php )
$lnk = $_REQUEST['link'];
$facebook->setFileUploadSupport(true);
$attachement = array(‘access_token’ =>开发者_运维百科 $session['access_token'],
‘source’ =>’@’ . realpath($lnk),
‘name’ => ‘my ------ friend’,
‘message’ => ‘m pic;get yours at http://apps.facebook.com//‘
);
$fb_photo = $facebook->api(‘me/photos’,'POST’,$attachement);
dump of response error :::::::::::::::::::::::::::::::::::::::::::::::::::
> curlException occuring:
> [message:protected] => failed creating
> formpost data [string:private] =>
> [code:protected] => 26
> [line:protected] => 639
> [trace:private] => Array ( [0] =>
> Array (
>
> [file] =>
> /home/*******/public_html/******/facebook.php [line] => 592 [function] =>
> makeRequest [class] => Facebook [type]
> => -> [args] => Array ( [0] => https://graph.facebook.com/me/photos
> [1] => Array (.....
please help regarding this; it will be great;
stuck in this issue;
精彩评论