You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I tried to upload json file, I found this error: MulterError: Unexpected field at wrappedFileFilter (E:\nodejs-projects\uploadFiles\node_modules\multer\index.js:40:19) at Multipart.<anonymous> (E:\nodejs-projects\uploadFiles\node_modules\multer\lib\make-middleware.js:107:7) at Multipart.emit (node:events:513:28) at HeaderParser.cb (E:\nodejs-projects\uploadFiles\node_modules\busboy\lib\types\multipart.js:358:14) at HeaderParser.push (E:\nodejs-projects\uploadFiles\node_modules\busboy\lib\types\multipart.js:162:20)
how can I upload json file and add extension of file ? what abou Xlsx files ?
The text was updated successfully, but these errors were encountered:
Hello, SheikhEIMoctarG, for uploading the specific type of data , you have to configure the multer explicitly
const upload = multer({
storage: storage,
fileFilter: function (req, file, cb) {
// Allow only JSON and Xlsx files
if (file.mimetype === 'application/json' || file.mimetype === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
cb(null, true);
} else {
cb(new Error('Unsupported file type'), false);
}
},
});
when I tried to upload json file, I found this error:
MulterError: Unexpected field at wrappedFileFilter (E:\nodejs-projects\uploadFiles\node_modules\multer\index.js:40:19) at Multipart.<anonymous> (E:\nodejs-projects\uploadFiles\node_modules\multer\lib\make-middleware.js:107:7) at Multipart.emit (node:events:513:28) at HeaderParser.cb (E:\nodejs-projects\uploadFiles\node_modules\busboy\lib\types\multipart.js:358:14) at HeaderParser.push (E:\nodejs-projects\uploadFiles\node_modules\busboy\lib\types\multipart.js:162:20)
how can I upload json file and add extension of file ? what abou Xlsx files ?
The text was updated successfully, but these errors were encountered: