我有一个标准的文件上传表单,我想用它来收集用户的图像,然后上传到 Facebook。
如果我将上传表单发布到FB 'staging' url,我会得到编码的 staging 参考 - 但是当我尝试启动FB.UI()
feed 对话框时,将 staging 令牌作为“picture”参数提供它会失败吗?
暂存 URL 是否严格用于使用对话框创建图形对象?如果我想使用该对话框,我是否必须将图像上传到其他地方而不是引用它?
这是我的例子:
$('#picture_upload').submit(function(e){
e.preventDefault();
$(this).attr('action',$(this).attr('action')+'?access_token='+accessToken);
$(this).ajaxSubmit({
success: function(response){
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
picture: response.uri,
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
} //call function after success
});
});
响应包含以下内容:
{"uri":"fbstaging://graph.facebook.com/staging_resources/MDAxMDE1MTU3NjIyNzExNzYwNA=="}
这作为函数picture
中的参数显然是无效的FB.UI