0
我試圖通過使用MVC3 C#上傳照片到Facebook。代碼運行成功,但照片未上傳到Facebook。我正在添加ID和App Secret。我嘗試了很多方法,並在很多天裏努力工作,但結果爲零。這裏是我的控制器代碼如何使用MVC3,C#在Facebook牆上上傳圖片?
[HttpPost] [HTTPGET]
public ActionResult Profile(HttpPostedFileBase file, FacebookOAuthResult facebookOAuthResult) {
dynamic args = new ExpandoObject();
args = new Dictionary<string, object>();
args["message"] = "hi";
args["picture"] = "http://apps.facebook.com/Uploads/photos";
string accesstoken=FacebookWebContext.Current.AccessToken;
FacebookClient fbApp = new FacebookClient(accesstoken);
try {
fbApp.Post("MYAPPID" + "/Photos", args);
} catch (FacebookOAuthException ex) {
//
}
// Verify that the user selected a file
if (file != null && file.ContentLength > 0) {
var path1 = Path.Combine(Server.MapPath("~/Content/uppoads"), file.FileName);
//file.SaveAs(path1);
fbApp.Post("MYAPPID" + "/photos", path1);
}
// redirect back to the index action to show the form once again
return RedirectToAction("Profile");
}
誰能幫我找到解決辦法?提前致謝。
請您發送完整的代碼爲這個控制研究和.cshtml – siva 2012-07-12 05:06:01
如何傳遞的Facebook牆上這些圖片來自按鈕字段 – siva 2012-07-19 10:25:17
最後我成功我從我MVC3應用程序上傳圖片至Facebook – siva 2012-07-23 03:48:42