2

How can i edit this code to post on my wall a photo that are for example in the directory: "C:\myfiles\myphoto.jpg"?

FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class,
  BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
  Parameter.with("message", "Test cat"));
David
  • 21
  • 2
  • possible duplicate of [Local file access with javascript](http://stackoverflow.com/questions/371875/local-file-access-with-javascript) – Evan Oct 29 '13 at 14:46
  • @Evan , how is this a duplicate?? Its a different question completely i think. – Jhanvi Oct 31 '13 at 04:53

1 Answers1

2

You just have to replace cat.png in the code with your absolute image path.Something like this:

    InputStream is = new FileInputStream(new File("C:\\myfiles\\myphoto.jpg"));
    FacebookType publishVideoResponse =facebookClient.publish("me/photos",FacebookType.class,
            BinaryAttachment.with("myphoto.jpg", is),
            Parameter.with("message", "MY PHOTO POST"));        
Jhanvi
  • 5,069
  • 8
  • 32
  • 41