有人使用 Javascript 成功将照片上传到 Facebook Graph API 吗?
我'我在 JS Graph API 方面取得了巨大成功,这是我第一次挂断电话。
此代码不能保存照片,但可以保存相册。
function saveImage() {
FB.api("/me/albums", "post", {
message:"album message",
name: "name of album"
}, function(response) {
console.log(response.id) // id of album, yes?
FB.api("/99999999/photos", 'post', {
message:"hji",
source: "@http://url/to/image/markz.png"
}, function(response) {
console.log(response)
});
});
它确实创建了一个相册,但保存图像时出现错误: message: "(#324) 需要上传文件"
我已经尝试过在源前面没有@。我尝试了许多变体,包括在发送对象中提供身份验证令牌。我已经通过终端中的curl 成功保存了图像。
- 我有权 update_stream
- 我已经过身份验证
- 我已经彻底搜索了互联网并阅读了大量的 PHP 博客,了解他们如何在 PHP 中做到这一点。
Possible Duplicate:
Facebook new javascript sdk- uploading photos with it!
I've had great success with the JS Graph API, and this is my first hang up.
This code does NOT work to save a photo, but it does save an album.
function saveImage() {
FB.api("/me/albums", "post", {
message:"album message",
name: "name of album"
}, function(response) {
console.log(response.id) // id of album, yes?
FB.api("/99999999/photos", 'post', {
message:"hji",
source: "@http://url/to/image/markz.png"
}, function(response) {
console.log(response)
});
});
It does create an album, but saving an image gives me the error: message: "(#324) Requires upload file"
I've tried it without the @ in front of the source. I've tried many variations including providing the auth token in the sending object. I have successfully saved an image via a curl in the terminal.
- I have permission to update_stream
- I'm authenticated
- I have thoroughly search the internet and read a plethora of PHP blogs how they do it in PHP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚对重复的问题提供了类似的答案:
Facebook 新的 javascript sdk - 用它上传照片!
希望这有帮助。
相机学校辍学
I just provided an similar answer to a duplicate question:
Facebook new javascript sdk- uploading photos with it!
Hope this helps.
CameraSchoolDropout