gpt4 book ai didi

Node.js maxFieldSize 超出

转载 作者:太空宇宙 更新时间:2023-11-03 22:39:19 28 4
gpt4 key购买 nike

我正在将一组图像上传到我的 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
}

...

最佳答案

你尝试过吗:

    app.use(express.limit('15mb'));

关于Node.js maxFieldSize 超出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11148086/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com