0

使用strapi 3.0.0-alpha.14.1.1,上传本地文件提供程序和mongodb,它无法上传500 MB的文件。尽管“允许的最大大小(以 MB 为单位)”设置为 10000 MB,但它会引发以下错误:

使用卷曲:

curl -X POST -F 'files=@/development/TestFiles/largefile.zip' http://localhost:1337/upload

{"message":"An internal server error occurred","statusCode":500,"error":"Internal Server Error"}

使用管理面板:

Error: maxFileSize exceeded, received 209780558 bytes of file data
at Stream.<anonymous> (/usr/lib/node_modules/strapi/node_modules/formidable/lib/incoming_form.js:222:19)
at emitOne (events.js:116:13)
at Stream.emit (events.js:211:7)
at MultipartParser.parser.onPartData (/usr/lib/node_modules/strapi/node_modules/formidable/lib/incoming_form.js:387:14)
at callback (/usr/lib/node_modules/strapi/node_modules/formidable/lib/multipart_parser.js:102:31)
at dataCallback (/usr/lib/node_modules/strapi/node_modules/formidable/lib/multipart_parser.js:112:11)
at MultipartParser.write (/usr/lib/node_modules/strapi/node_modules/formidable/lib/multipart_parser.js:305:3)
at IncomingForm.write (/usr/lib/node_modules/strapi/node_modules/formidable/lib/incoming_form.js:159:34)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/strapi/node_modules/formidable/lib/incoming_form.js:125:12)
at emitOne (events.js:116:13)
at IncomingMessage.emit (events.js:211:7)
at IncomingMessage.Readable.read (_stream_readable.js:475:10)
at flow (_stream_readable.js:846:34)
at resume_ (_stream_readable.js:828:3)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)

请问有什么帮助吗?

4

1 回答 1

1

感谢 Flux159(在 github 中)

在 github 中创建了一个问题并得到了以下工作响应。可能对其他人有用:

在 config/environments/development/request.json 中,您需要将 koa 正文解析器配置更改为强大:

示例:将 maxFileSize 设置为 500MB 以实现强大(数字以字节为单位,因此 500*1024*1024):

...
"parser": {
    "enabled": true,
    "multipart": true,
    "formidable": {
      "maxFileSize": 524288000
    }
  },
...

有关详细信息,请参阅:https ://github.com/strapi/strapi/issues/1975#issuecomment-423839266

于 2018-11-15T13:33:01.080 回答