Sails 0.10 req.files empty on file upload

血红的双手。 提交于 2020-01-05 12:14:09

问题


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

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

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?

Thanks!


回答1:


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)



来源:https://stackoverflow.com/questions/22780030/sails-0-10-req-files-empty-on-file-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!