I am creating this url from jquery with an access token
www.mysite.com/xyz.php?access_token=valid_access_token&id=1
and to upload photo I am using this code in xyz.php
$facebook = new Facebook(array(
'appId' => 'my_app_id',
'secret' => 'my_app_secret',
));
// Get User ID
$user = $facebook->getUser();
$facebook->setFileUploadSupport(true);
$args = array('message' => 'my_message');
copy($image, 'tmp/file.jpeg');
$args['image'] = '@' . realpath('tmp/file.jpeg');
$data = $facebook->api('me/photos', 'post', $args);
unlink('tmp/file.jpeg');
but it doesn’t work. I get this error
Uncaught OAuthException: An active access token must be used to query information about the current user.
I have created a access token. why am I getting this error?
how can I use the accessToken(which is in my url) in my code to upload image?
You need to get the user’s access token to perform any action on behalf of the user. Try using the following code…