我正在尝试将照片上传到 Facebook,但我找不到似乎可以让 multipart
上传工作。我找不到执行此操作的任何文档或库。有没有其他人对此有任何好运?
最佳答案
查看 restler代替这个库。我已经将它用于这个确切的目的,而且效果很好。
这里是他们示例中的一些修改代码,以显示文件 POST 的运行方式。
// multipart request sending a file and using https
rest.post('https://twaud.io/api/v1/upload.json', {
multipart: true,
data: {
'sound[message]': 'hello from restler!',
'sound[file]': rest.file('doug-e-fresh_the-show.mp3', null, null, null, 'audio/mpeg')
}
}).on('complete', function(data) {
sys.puts(data.audio_url);
});
关于http - Node.JS 分段上传到 facebook 图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9504825/