如此处文档https://sailsjs.com/documentation/reference/configuration/sails-config-http#?configuring-skipper所述,我确实取消了对配置的注释,如下所述,
module.exports.http = {
middleware: {
order: [
'cookieParser',
'session',
'bodyParser',
'compress',
'poweredBy',
'router',
'www',
'favicon',
],
bodyParser: (function _configureBodyParser(){
var skipper = require('skipper');
var middlewareFn = skipper(
{
strict: true,
limit: '50mb'
});
return middlewareFn;
})(),
},
};
即使在此之后,我也无法上传超过1 MB的文件。
正在使用的船长版本:“ sails”:“ ^ 1.0.2”
使用的帆船版本:“船长”:“ ^ 0.8.7”
答案 0 :(得分:1)
编辑文件config/http.js
和取消注释跳过部分。添加限制选项。
bodyParser: (function _configureBodyParser(){
var skipper = require('skipper');
var middlewareFn = skipper({strict: true, limit: '5mb'});
return middlewareFn;
})(),