Looking for some code to upload a photo to facebook using the Graph API in VB.NET. I have the Facebook C# SDK, but it doesn’t support uploading photos as far as I can tell.
Accessing the photos works fine and I can send other content to Facebook fine as well. Just not photos.
The facebook documentation talks about attaching the file as a form-multipart request, but I have no idea how to do that. To say that its not very well documented is to put it lightly. Even the guys I hire to do this kind of thing couldn’t get it to work.
I’ve found this: Upload Photo To Album with Facebook's Graph API, but it only describes how to do it in PHP.
I’ve also seen varying method from different sites about passing the URL of the photo as a part of the HTTP request, but after trying local or remote URLs several times I kept getting a bad url error or something like that.
Any thoughts?
You need to pass the Image in a POST request to the Graph API (Need publish_stream permission). What is mentioned in Facebook Documentation is correct. Following is the example code that may do the work. use it inside a method. (Code is in C#)
Legend
<content>: you need to provide the info.Update
Please post comments to improve the code.