3
我正在使用twit。更新状态(无媒体)工作正常,但update with media不起作用。
这是我的代码(有明确使用):如何使用twit执行媒体POST请求的更新?
//client side
<form id="tweeter" action='/image' method='POST' >
<input type="text" name="tw" id="tw" />
<input type='file' name='img' id='img' />
<input type="submit" value="submit" />
</form>
//server side
app.post('/image',function(req,res){
var f= "./" +req.body.img;
console.log(req.body.img);
T.post('statuses/update_with_media',
{ status: req.body.tw, media: f },
function(err, reply) {
console.log('ERROR:' +err);
console.log('REPLY:' +reply);
}
);
});
我得到的错误是“缺少或无效的URL参数”。
如何通过media[]
发送图像文件?
我包含了fs库,并尝试了上面的代码。它提供了一个错误,说无效的数据。 – Aravind