为了账号安全,请及时绑定邮箱和手机立即绑定

[node]有关于multer中间件的。。。

[node]有关于multer中间件的。。。

qq_挺问中原_0 2016-07-02 17:08:10
express框架,使用multer中间件,用form表单post请求接口,返回500;二话不说,先上代码。。。这个是路由设置的://routes.js saveUrl=multer({dest:path.join(__host,'public','demo')}) app.post( '/addDemo', saveUrl.single('files1'), function(req,res){ handle=require('./post/addDemo.js'); handle(req,res); } );这是handle里面处理的//addDemo.js //什么都没有处理,直接end,对吧。。。 var querystring=require('querystring'); var db=require(__host+'/db/mongod.js'); module.exports=function(req,res){ console.log(req.body); res.end(); }这个是html代码:<form method="post" action="http://localhost:3000/addDemo" enctype="multipart/form-data">     <input type="text" name="name"/>     <input type="file" name="files1"/>     <input type="submit" value="提交"/> </form>这个是返回值:这个500是怎么来的。。。为什么会出现500?另外。。。。这个提问不能使用makedown语法么?。。。
查看完整描述

1 回答

?
慕妹2970887

TA贡献3条经验 获得超0个赞

我也遇到这个问题, 请问楼主解决了吗

查看完整回答
反对 回复 2018-01-04
  • 1 回答
  • 0 关注
  • 1494 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信