Click here to Skip to main content
15,881,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi
follow code is correct with /me/photo but get error with /me/feed !!! why??
thanks for your help


Output:
HTML
{
   "error": {
      "message": "(#100) source is not properly formatted",
      "type": "OAuthException",
      "code": 100
   }
}


My javascript Code:
JavaScript
function postPicToFacebookWallAjax() {
  var authToken = $('#hfAccessToken').val();
  var files = $("#flUpload").get(0).files;

  var fd = new FormData();
  fd.append("source", files[0]);
  fd.append("access_token", authToken);
  fd.append("caption", "caption");
  fd.append("message", "Test Message");

  fd.append("name", "Name");
  fd.append("description", "Description field");

  var url = "https://graph.facebook.com/me/feed?access_token=" + authToken;
  try {
    $.ajax({
      url: url,
      type: "POST",
      data: fd,
      processData: false,
      contentType: false,
      cache: false,

      success: function(data) {
        alert("success " + data);
      },

      error: function(shr, status, data) {
        alert("error " + data + " Status " + shr.status);
      },

      complete: function() {
        alert("Posted to facebook");
      }
    });

  } catch (e) {
    alert(e);
  }
}
Posted
Updated 28-Jun-15 4:27am
v2
Comments
Kornfeld Eliyahu Peter 28-Jun-15 6:04am    
Check Facebook API documentation...
Iounes Manochehri 28-Jun-15 7:46am    
I check that but i can find any way for that
this code work for me/photo but not work for me/feed

thanks
Afzaal Ahmad Zeeshan 28-Jun-15 9:59am    
We cannot help you, unless we know what is the program going to do, what error it gives and so on. Question is unclear.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900