preface:
This error occurs when using the upload function of egg.
1. Error message:
Error in file name
2. Error reporting reason:
There is no configuration file information in config.default.js, but it is directly obtained in the controller, and an error CTX. Request. Files = = undefined is reported
const file = ctx.request.files[0]; //Get uploaded files
3. Solution:
Add in config.default.js:
//Enable file mode
config.multipart = {
mode: 'file'
}
4. Cause new problems: Invalid filename: order information.xlsx
5. Solutions to new problems and types have to be set. There is a parameter in the upload that is a white list
Add: whitelist: [‘. Xlsx’] in config.default.js
//Enable file mode
config.multipart = {
mode: 'file',
fileSize: 1048576000,
whitelist: ['.xlsx']
}
That’s it!
Read More:
- [Solved] Postman Error: Unsupported Media Type
- [Solved] FileUploadException: the request was rejected because no multipart boundary was found
- [Solved] An error occurred while processing your request…enable the Development environment by setting …
- C Language error: two or more data types in declaration specifiers
- How to Solve Nginx 413 Error (request entity too large)
- [Solved] MacOS Compile ffmpeg Error: ERROR: openssl not found
- TensorFlow issue: Expected int32, got list containing Tensors of type ‘_Message’ instead.
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘globalTransa
- [Solved] Compile Error: “Configure: error: libtool configure failed”
- [Solved] Wechat IOS signature error config:fail
- [Solved] throw new Error(“‘output.filename’ is required, either in config file or as –output-filename”);
- Filezilla Error: You appear to be behind a NAT router. Please configure the passive mode settings and …
- How to Solve Arxiv Upload with PDFLatex Error
- Android r compiles OTA times error: ExternalError: Invalid ro.product.property_source_order
- The reason and solution for the error ECONNRESET of the httpClieint request of Node.js
- [Solved] the request was rejected because its size (11579386) exceeds the configured maximum (10485760)
- How to Solve Error: could not list the contents of folder
- css-rcurlyexpected Error: css-rcurlyexpected at-rule, or selector expected, Do not use empty rulesets
- [Solved] Eureka registry service starts error: Request execution error. Endpoint = defaultendpoint
- [Solved] Springcloud config Error: Error occured cloning to base directory.