我希望能够将图像上传添加到我正在开发的网站,但我不知道这应该如何与meteorjs一起使用。有没有办法在meteorjs上接受多部分表单?即图像上传?
我总是可以安装一个小型 sinatra 应用程序来上传文件,但我不愿意。
最佳答案
您需要编写一个中间件来接受此类请求。
WebApp.connectHandlers.stack.splice(0, 0, {
route: '/your/url/for/inputs',
handle: function(req, res, next) {
// Handle request and response
// just like you would do in node.js.
// Make sure to wrap your db calls in Fibers.
// Use next() if you change your mind
// and don't want to handle this request after all.
},
});
关于node.js - 有没有办法在meteorjs上接受多部分表单?即图像上传?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19181956/