Guest User

Untitled

a guest
Jul 20th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Post photo to facebook page using javascript and graph api
  2. <form enctype="multipart/form-data" method="post" action="https://graph.facebook.com/<page_id>/feed" target="ifram_name">
  3. <input name="source" type="file" style="font-size:13px;" />
  4. <input type="hidden" name="to" value="113342002047830"/>
  5. <input type="hidden" name="access_token" value="user_accesstoken"/>
  6. <input type="hidden" name="type" value="photo" />
  7. </form>
  8.  
  9. <form action="https://graph.facebook.com/PAGE_ID/photos"
  10. method="post" enctype="multipart/form-data">
  11. <input name="source" type="file">
  12. <input type="hidden" name="to" value="113342002047830"/>
  13. <input type="hidden" name="access_token" value="user_accesstoken"/>
  14. </form>
  15.  
  16. {
  17. "id": "1001207389476"
  18. }
  19.  
  20. FB.api('/PAGE_ID/photos', 'post', {
  21. url: 'http://example.com/image.png',
  22. message: 'Upload demo'
  23. }, function(response){
  24. if (response && response.id)
  25. console.log('Photo uploaded', response.id);
  26. });
Advertisement
Add Comment
Please, Sign In to add comment