asp.net mvc 3 - How to upload images on Facebook wall by using MVC3, C#? -


I am trying to upload photos in Facebook using MVC3 C #. This code is running successfully but photos are not being uploaded to Facebook. I'm getting an Ad ID and App Secret I tried several ways and for several days I worked hard, but the result is zero. Here is the code of my controller. [HTTP Post] [HTPGet]

  Public functioning profile (HTTP posted filebase file, FacebookOtherthat FacebookOththRabel) {Dynamic Args = New Extendo Object () ; Args = new dictionary & lt; String, Object & gt; (); Args ["message"] = "hello"; Args ["picture"] = "http://apps.facebook.com/uploads/photos"; String accesstoken = FacebookWebContext.Current.AccessToken; FacebookClient fbApp = New FacebookClient (accesstoken); Try {FbApp.Post ("MYAPPID" + "/ photo", Args); } (FacebookOAuthException ex) {//} Verify that the user has selected a file if (file! = Null & file. Content length> gt; {var path1 = path.combin (Server.MapPath ("/ Content / uppods"), file. File names); //file.SaveAs(path1); FbApp.Post ("MYAPPID" + "/ photo", Path 1); } // Redirect to Index Action to show the form Once again Redirectctoaction ("Profile"); }   

Can someone help me find a solution? thank you in advanced.

You can post the local path of the photo on Facebook, FB does not know what is.
You should post photos as binary in post body

  var media = new Facebook.FacebookMediaObject (); Var filebytes = System.IO.File.ReadAllBytes (path1); Media.SetValue (filebytes); FbApp.Post ("248050331932489" + "/ photo", media);    

Comments