我正在将一组图像上传到我的 node.js express 服务器,但出现错误 - “错误:超出 maxFieldsSize”。看起来默认的 maxFieldsSize 是 2MB。我需要能够上传多达 15MB 的数据。如何增加 MultipartParser 的 maxFiedsSize?
编辑:
exports.perform = function(req, res) {
incomingForm.maxFieldsSize = 20 * 1024 * 1024; // increase fields size?
var json = req.body;
var nodemailer = require('../node_modules/nodemailer');
var fs = require('fs');
var exec = require('child_process').exec;
var events = require('events');
var mustache = require('../html/mustache');
// build html
var buildHtml = function(error) {
console.log("building html");
var html = fs.open('./temp.html', 'w');
var strTemplate;
if (json.user_language == 'de')
strTemplate = fs.readFileSync('./email/RM01_CLAIM_FORM_DE.html').toString();
else
strTemplate = fs.readFileSync('./email/RM01_CLAIM_FORM_EN.html').toString();
// get data
var data = {
passenger_name : json.first_name + ' ' + json.last_name,
passenger_address : json.passenger_address,
passenger_telephone : json.passenger_telephone,
passenger_email : json.passenger_email,
flight_info : json.flight_info,
ticket_number : json.ticket_number,
complaint_reason : json.complaint_reason,
extraordinary_circumstances : json.extraordinary_circumstances,
legal_insurance : json.legal_insurance,
comments : json.comments,
language : json.user_language,
media : json.media_attachments
}
...