1:接受文件
可以用下列的第三方库
•busboy and connect-busboy •multiparty and connect-multiparty •formidable •multer
2:保存文件
ps:nodejs get/request
灌水评论示例:
PHPSESSID=1uunfnq1rdhup7tudcre36l8h1; jwplayer.qualityLabel=é«æ¸
; cvde=569454113f947-13; Hm_lvt_f0cfcccd7b1393990c78efdeebff3968=1452475311,1452561427; Hm_lpvt_f0cfcccd7b1393990c78efdeebff3968=1452579983; imooc_isnew=2','Host':'www.imooc.com','Origin':'http://www.imooc.com','Referer':'http://www.imooc.com/comment/348','User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/45.0.2454.99 Safari/537.36','X-Requested-With':'XMLHttpRequest'
}
}
var req = http.request(options,function(res) {
console.log('Status: ' + res.statusCode);
console.log('headers: ' + JSON.stringify(res.headers));
res.on('data',function(chunk) {
console.log(Buffer.isBuffer(chunk));
console.log(typeof chunk);
});
res.on('end',function() {
console.log('评论完毕');
});
});
req.on('error',function(e) {
console.log('Error: ' + e.message);
});
req.write(postData);
req.end();
原文链接:https://www.f2er.com/nodejs/50553.html