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] throw new Error(“‘output.filename’ is required, either in config file or as –output-filename”);
- [Solved] nodejs Error: request entity too large
- How to Fix Node SASS Error in Vue + webpack project after nodejs upgrade
- json-server Error: EPERM: operation not permitted, mkdir ‘C:\Progra m Files\nodejs\node_
- [Solved] Pip install icu failed: Command “python setup.py egg_info” failed with error code 1 in
- [Solved] SyntaxError: Invalid regular expression: invalid group specifier name
- [Solved] Appium Error: InvalidArgumentException: Message: invalid argument: invalid locator
- [How to Solve] Nodejs: interface error CORS error
- [Solved] HALCON error #5190: Invalid window parameter
- [Solved] MindSpore Error: “RuntimeError: Invalid data, Page size.”
- [Solved] error: invalid operands of types ‘const char [6]‘ and ‘const char [6]‘ to binary ‘operator+‘
- Stata Comment // Error / invalid name r(198); [How to Solve]
- System Startup and Display: [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid
- Android r compiles OTA times error: ExternalError: Invalid ro.product.property_source_order
- git error:invalid path [How to Solve]
- [Solved] mybatis plus Error: Invalid bound statement (not found)
- [Solved] Notwritablepropertyexception: invalid property ‘mapperhelper’ of bean class
- [How to Solve] Error: Invalid or corrupt jarfile…
- latex Package inputenc Error: Invalid UTF-8 byte “A1
- [Solved] Android Studio Compile Error: Invalid main APK outputs : EarlySyncBuildOutput