大佬教程收集整理的这篇文章主要介绍了node.js – req.busboy.on(‘file’)没有触发,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
form(method='post',action='/encoder_post',enctype='multipart/form-data') .form-group label(for='name') Name input.form-control(type='text',id='name',name='name') .form-group label(for='message') message input.form-control(type='text',id='message',name='message') .form-group label(for='file') Audio File (*.wav) input.form-control(type='file',id='file') button.btn.btn-cicada.btn-block(type='submit') Submit
在encoder_post里面,我有以下函数来处理post请求:
router.post('/',function(req,res){ req.busboy.on('file',function(fieldname,file,filename,encoding,mimetypE) { console.log("this is in file"); }); req.busboy.on('field',function(key,value,keyTruncated,valueTruncated) { console.log("The value is: " + value); }); req.pipe(req.busboy); });
但是,每当我提交表单时,“字段”处理程序都会触发,但“文件”不会触发.
在app.js里面我有:
var busboy = require('connect-busboy'); app.use(busboy());
有任何想法吗?
以上是大佬教程为你收集整理的node.js – req.busboy.on(‘file’)没有触发全部内容,希望文章能够帮你解决node.js – req.busboy.on(‘file’)没有触发所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。