2

I can succesfuly upload pictures to my own wall by posting an image to https://graph.facebook.com/me/photos. Now i need to post to a page's wall instead. I have the page ID, but when i change "me" in the url to the pages ID, the image is still posted to my own wall instead of the page's. How do i post an image to a page's stream?

And which permissions is required to do so?

It would be great if you guys could help me out, has got stuck on this one. Thank you!

Anton Gildebrand
  • 3,641
  • 12
  • 50
  • 86

2 Answers2

3

You cannot upload pictures to wall (it's uploading to album).

To upload picture to Page's Album you need to use page access_token that is accessible via accounts connection of user (you'll need manage_pages permission to get this info).

Once you have access_token for page you may upload picture in the same way as you do for user but using page id instead of user id (you will need publish_stream permission for user to post content pages he own).

Juicy Scripter
  • 25,778
  • 6
  • 72
  • 93
  • But regular users, that aren't page admin can't upload images to an album. At least they can't do so from Facebook, do you mean it would be possible using the Graph API? – Anton Gildebrand Feb 19 '12 at 23:41
  • I can share an image to the page wall, that must be possible from the Graph-API, right? – Anton Gildebrand Feb 19 '12 at 23:42
  • 1
    Nope, regular users who is not admin of the page cannot upload photos to album. Yes, regular users can share image on page wall via Graph API (using `feed` connection of `page` and creating `post` or `link`) this will look on wall not the same as photo uploaded to album. This is completely different question which is already answered on [so]. – Juicy Scripter Feb 20 '12 at 07:50
0

m_imgData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"Default.png"]];

NSMutableDictionary *fbArguments = [[[NSMutableDictionary alloc] init] autorelease];

[fbArguments setObject:self.m_imgData forKey:@"source"];
[fbArguments setObject:@"Uploading images" forKey:@"message"];


[m_facebook requestWithGraphPath:@"Page_ID/photos"
                       andParams:fbArguments
                   andHttpMethod:@"POST"
                     andDelegate:self];

Where i am using Default.png as a image to upload. m_facebook is allocated object of Class Facebook (Provided as a part of Facebook SDK). m_imageData is an object of NSData.

Venu Gopal Tewari
  • 5,672
  • 42
  • 41