简体   繁体   中英

Uploading photos to a page using Facebook Graph API

Using the Facebook Graph API I'm trying to upload an image to my page (authorized as a page with a working persistent access token I obtained through this excellent tutorial: http://www.testically.org/2011/09/27/5-steps-to-automatically-write-on-your-facebook-page-wall-using-the-graph-api-without-a-logged-in-user )

Even though I set the necessary permissions (manage_pages, publish_stream, photo_upload among others) and instantiated the Facebook SDK using the fileUpload property, the upload is still not working, I'm always getting:

(#200) Subject does not have permission to post photos on this page

Posting anything through xxx/feed works fine though.. The code itself is of course fairly basic:

    $content = array('access_token' => xxx, 'source' => "@".realpath("test.jpg"), 'message' => "test");
$facebook->api("/xxx/photos", "post", $data);

Calling the API using cURL doesn't work for me either.

I'm really pulling my hairs out on this one.. Has anyone tried uploading to their page as a page?

Thanks!

Maybe to old, but set in your Fansite Setting "User can upload photos" and "User can write on your wall". Than the error is gone.

Yes, even the admin with permanent fanpage access tokken is for facebook api a normal user. (Maybe bug..)

You are posting the photo using the User Access Token and not the Page Access Token.

Perform a FBRequest to the Graph Path //accounts in order to get Pages Access Token.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM