Search code examples
facebookcurlphotos

cURL example of posting photos remotely to Facebook?


I am currently having a problem, where I try to post a picture to Facebook and I get an "error" response:

"Requires upload file", with OAuth exception #324.

I have the access token in there just fine and I can adapt my code from a cURL example relatively easily. All the examples I can find show how to do it in PHP (which I don't know) or something of the like. Any help with an example of how to upload a photo just from the cURL command line tool would be greatly appreciated.

I just can't find what I am looking for anywhere for the life of me.


Solution

  • Are you appending with the @ character?

    curl -F 'access_token=xxx' \ 
         -F 'source=@img.jpg' \
         -F 'message=Test' 
         'https://graph.facebook.com/me/photos'