Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Post photo to facebook page using javascript and graph api
- <form enctype="multipart/form-data" method="post" action="https://graph.facebook.com/<page_id>/feed" target="ifram_name">
- <input name="source" type="file" style="font-size:13px;" />
- <input type="hidden" name="to" value="113342002047830"/>
- <input type="hidden" name="access_token" value="user_accesstoken"/>
- <input type="hidden" name="type" value="photo" />
- </form>
- <form action="https://graph.facebook.com/PAGE_ID/photos"
- method="post" enctype="multipart/form-data">
- <input name="source" type="file">
- <input type="hidden" name="to" value="113342002047830"/>
- <input type="hidden" name="access_token" value="user_accesstoken"/>
- </form>
- {
- "id": "1001207389476"
- }
- FB.api('/PAGE_ID/photos', 'post', {
- url: 'http://example.com/image.png',
- message: 'Upload demo'
- }, function(response){
- if (response && response.id)
- console.log('Photo uploaded', response.id);
- });
Advertisement
Add Comment
Please, Sign In to add comment