Q:

Post a image on facebook using Javascript api error 324 requires upload file

FB.login(function(response) {
                            if (response.authResponse) 
                            {

                              FB.api('/me/photos', 'post',
                            {

                                url:'http://test.xyzfoodservices.com/wp-content/plugins/facebook_login/single.jpg'

                            }, function(response) {
                                if (!response || response.error) {
                                    console.log(response.error);
                                    console.log(response);
                                } else {
                                    alert('Success: Content Published on Facebook Wall');
                                }
                            });
                           FB.api('/me/picture?type=normal', function(response) {

                           var str="<figure class='tint'> <img id='img' src='"+response.data.url+"'/></figure>";
                           document.getElementById("popUpDiv").innerHTML+=str;
                           }); } else 
                                 {
                          console.log('User cancelled login or did not fully authorize.');
                                 }
                          },{scope: 'email,user_photos,user_videos'});

I had Successfully got access from Facebook .But While I try to post a image on User wall facebook javascript 324 requires upload file. I had test many codes and solutions But nothings helps me up. So Please Answer some Different solutions because i already tried solutions which provided on stack OverFlow.
Thanks in Advance.

A:

FB.api(
"/me/photos",
"POST",
{
    "url": "{image-url}"
},
function (response) {
  if (response && !response.error) {
    /* handle the result */
  }
}
);

