【发布时间】:2015-10-06 04:59:50
【问题描述】:
我正在尝试使用中所示的方法将照片上传到 facebook https://developers.facebook.com/docs/graph-api/reference/user/photos/
如果照片已经在互联网上,我可以使用如下所示的 url 参数进行上传。
$scope.uploadPicture = function () {
FB.api(
"/me/photos", 'post', {
caption: "Testing uploadPicture",
access_token: authFact.getAccessToken(),
url: 'http://www.website.com/somejpg.jpg'
},
function (response) {
if (response && !response.error) {
console.log(response);
}
}
);
};
我希望能够将本地机器上的图片作为 multipart/form-data 发布。
有人能指出我正确的方向吗?
我的 html 是这样的
<form>
<div class="form-group">
<label for="fileInput">File input</label>
<input type="file" id="fileInput">
<p class="help-block">Example block-level help text here.</p>
</div>
<div class="form-group">
<label for="itemName">Name: </label>
<input type="text" class="form-control" id="itemName" placeholder="Enter Name here..">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
【问题讨论】:
标签: angularjs facebook facebook-graph-api