Node.JS分段上传到脸谱图
我试图上传一张照片到Facebook,我无法find似乎得到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); });