I want users to post an image on a facebook page via a form on a website. When they have logged in via facebook on this website, they can select an image from their computer.
Once they have selected the image, I want it to be posted to the users wall, and in an album of the page where I'm one of the administrators.
I have created an app for this, but we can't seem to find a way to get the app to post on this facebook-page.
Do we need to set any permissions on this page or app?
To upload images to a facebook page of which you're an admin you need to do the following:
1.) Create a facebook application (the usual way), make sure you specify the Canvas URL
2.) Navigate to the url below logged in as the admin of the page, and give the permissions (user_photos,manage_pages,offline_access,publish_stream)
3.) When you give the application the required permissions you'll be redirected to canvas_url#access_token=*access_token*, for example
4.) Then navigate to
(use the access token from #3). This will list the pages you administer; write down the access_token for the page(s) to which you want to upload the image
I'm not 100% sure but I believe that using graph api you can upload images only to albums created via graph api; i.e. you need to first create an album via graph api. Here's sample code using curl:
The
$data
above will contain the album id, which you'll need to upload a photo: