Closed confile closed 11 years ago
The publishFile method you are calling is taking a local filePath:
def publish(String connection, Map parameters = [:], String filePath = '') {
...
If you want to publish a remote file, you can use another method signature which takes a fileInputStream:
def publish(String connection, Map parameters = [:], String fileName, FileInputStream fileInputStream) {
...
This is what I did and it is not working. Do you have a working sample for me?
def userAccessToken = facebookContext.user.token
def facebookClient = new FacebookGraphClient(userAccessToken)
def someUrl = "http://www.google.com/images/logo.gif";
def file = File.createTempFile("facebookUpload",".temp").withOutputStream { out ->
out << new URL(someUrl).openStream()
}
def publishPhotoResponse = facebookClient.publish("me/photos", [message: "Test cat"], file)
I tried to publish an image to a user's facebook wall using:
def publishPhotoResponse = facebookClient.publishFile("me/photos", [message: "Test cat"], urlToImg)
urlToImg is the url to the jpg image file (e.g., http://www.mydomain.com/3324324 )
It always gives me a "File not found" error. What should I do?