如何用nodejs通过post发送multipart/form-data类型的http请求
1个回答
展开全部
给你个代码你看看
//发送单条消息给接口方app.post("/sendMsgToAByPost",function(req, res, next) {
//我的帖子:http://cnodejs.org/topic/4ffed8544764b729026b1da3
//http://yefeng.iteye.com/blog/315847
//http://stackoverflow.com/questions/5744990/how-to-upload-a-file-from-node-js
//http://stackoverflow.com/questions/9943010/node-js-post-file-to-server
console.log(req.files);
console.log(req.files.media.size);
var boundaryKey = Math.random().toString(16); //随机数,团碧目的是防止上传文件中出现分隔符导塌盯举致服务器无法正确识则判别文件起始位置
console.log(boundaryKey);
var options = {
//发送单条消息给接口方app.post("/sendMsgToAByPost",function(req, res, next) {
//我的帖子:http://cnodejs.org/topic/4ffed8544764b729026b1da3
//http://yefeng.iteye.com/blog/315847
//http://stackoverflow.com/questions/5744990/how-to-upload-a-file-from-node-js
//http://stackoverflow.com/questions/9943010/node-js-post-file-to-server
console.log(req.files);
console.log(req.files.media.size);
var boundaryKey = Math.random().toString(16); //随机数,团碧目的是防止上传文件中出现分隔符导塌盯举致服务器无法正确识则判别文件起始位置
console.log(boundaryKey);
var options = {
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询