posting screenshot to facebook, please help!

Using this code I found, I am wanting to post a screenshot to facebook, ive no clue how to and ive made little progress apart from finding this code. Any help would be appreciated!!

local facebook = require “facebook”

– You must use your own app id for this sample to work

local fbAppID = “123456789abcdefghi” --fake

local function onLoginSuccess()

– Upload ‘iheartcorona.jpg’ to current user’s account

local attachment = {

message = “Just a description of the photo.”,

source = { baseDir=system.ResourceDirectory, filename=“iheartcorona.jpg”, type=“image” }

}

facebook.request( “me/photos”, “POST”, attachment )

end

– facebook listener

local function fbListener( event )

if event.isError then

native.showAlert( “ERROR”, event.response, { “OK” } )

else

if event.type == “session” and event.phase == “login” then

– login was a success; call function

onLoginSuccess()

elseif event.type == “request” then

– this block is executed upon successful facebook.request() call

native.showAlert( “Success”, “The photo has been uploaded.”, { “OK” } )

end

end

That code should do most of what you want to do.  You do need to worry about this line:

source = { baseDir=system.ResourceDirectory, filename=“iheartcorona.jpg”, type=“image” }

system.ResourceDirectory is your app bundle.  You cannot write files there, so once you capture a screen shot, it will likely be saved to system.DocumentsDirectory.   Then filename=“iheartcorona.jpg” will need to be changed to the file name you save.  Facebook code can only be tested on devices.

In addition to this you need to add a couple of things to your build.settings file and you will need to set some stuff up on Facebook.  Make sure to read this guide:
 

http://docs.coronalabs.com/guide/social/setupFacebook/index.html

That code should do most of what you want to do.  You do need to worry about this line:

source = { baseDir=system.ResourceDirectory, filename=“iheartcorona.jpg”, type=“image” }

system.ResourceDirectory is your app bundle.  You cannot write files there, so once you capture a screen shot, it will likely be saved to system.DocumentsDirectory.   Then filename=“iheartcorona.jpg” will need to be changed to the file name you save.  Facebook code can only be tested on devices.

In addition to this you need to add a couple of things to your build.settings file and you will need to set some stuff up on Facebook.  Make sure to read this guide:
 

http://docs.coronalabs.com/guide/social/setupFacebook/index.html