问题
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