2013-10-29 127 views
2

如何編輯此代碼以在我的牆上發佈例如目錄中的照片: 「C:\ myfiles \ myphoto.jpg」?使用restFB在Facebook上發佈照片

FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class, 
    BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")), 
    Parameter.with("message", "Test cat")); 
+0

可能重複http://stackoverflow.com/questions/371875/local-file-access-with-javascript) – Evan

+0

@Evan,這是如何複製?我認爲完全是另外一個問題。 – Jhanvi

回答

2

你必須與你的絕對圖像path.Something這樣更換cat.png代碼:

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"));   
的[用JavaScript訪問本地文件(