在文件上传时,将0.10 req.files文件清空 [英] Sails 0.10 req.files empty on file upload

查看:149
本文介绍了在文件上传时,将0.10 req.files文件清空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过
$ b

I'm doing a file upload to sails v0.10 via

POST /file/upload HTTP/1.1
Host: localhost:1337
Cache-Control: no-cache

但req .files对象在sails中保持为空

but the req.files object remains empty in sails

upload: function(req,res) {
  console.log(req.files);    // {}                                                                                                                            
}

在我的文件控制器中。什么是我做错了?

in my file controller. What am I doing wrong?

谢谢!

推荐答案

知道自v0.10-rc6以后,Skipper-middleware会自动被使用,所以如果你遇到同样的问题,不要再使用'req.files',而是使用req.file('name')函数 https://github.com/balderdashy/skipper

One should know that since sails v0.10-rc6 the Skipper-middleware is automatically used, so if you're having the same issue, don't use 'req.files' anymore but use the req.file('name') function (https://github.com/balderdashy/skipper)

这篇关于在文件上传时,将0.10 req.files文件清空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆