質問

Facebook Graph API keeps returning "(#324) Requires upload file" when I attempt to upload an image using the /user/photos with the JS SDK.

The image is publicly accessible, the code is the exact copy of the example in the documentation and the permissions don't seem to be the issue. I've seen mention of initialization parameters to allow file uploads in old posts, but there are no mentions of it in the documentation so I didn't do anything.

The domain on which the image is hosted is not the same as the domain on which the application is server. Using mutlipart forms is simply not an option, I need facebook to fetch the image from the url. Here is the code I'm using.

Facebook.login(function(response) {
    if(response.status == 'connected' ){
           Facebook.api( "/me/photos","POST",{
               "object": {
                    "url": "http://sgpup.com/files/2013-07-02_00001.jpg",
                    "message": "A test message"
               }
           },
           function (response) {
               console.log(response);
               if (response && !response.error) {
                  console.log(response);
               }
            });
     }
},{scope : 'publish_stream,photo_upload'});

Thank you very much for your help.

役に立ちましたか?

解決

Replace the relevant code by this and try-

Facebook.api( "/me/photos","POST",{
                  "url": "http://sgpup.com/files/2013-07-02_00001.jpg",
                  "message": "A test message"
              },
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top