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