开发者

Multiple Photos upload on Facebook

Is there any way to upload multiple photos together on facebook... I have uploaded a single photo at a time using GraphAPI....but not multiple... P开发者_开发技巧lease suggest... Thanks...


You need to place a "batched" request to the Graph API. This is documented here: https://developers.facebook.com/docs/reference/api/batch/ (check out the paragraph "Uploading binary data"). Basically it's a cURL call where you json encode an array containing all the "batched" requests ("batch=[json array of calls]"). For some good reson Facebook limits your array to 20 requests. It translates pretty nicely to the PHP cURL methods, if you've got cURL enabled on your server...

curl 
 –F  'access_token=…' \
 -F  'batch=[{"method":"POST", \
              "relative_url":"me/photos", \
              "body":"message=My cat photo" \
              "attached_files":"file1" \
             },
             {"method":"POST", \
              "relative_url":"me/photos", \
              "body":"message=My dog photo" \
              "attached_files":"file2" \
             },
            ]’
 -F  'file1=@cat.gif' \
 -F 'file2=@dog.jpg' \
https://graph.facebook.com

UPDATE: replaced “ with " and ‘ with '

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜