Closed funcoder001 closed 4 years ago
hello @funcoder001 could you provide a small working example of this issue if it is still a problem for you. The express team get many issues raised and without working demonstrable examples it is tough for us to address them.
I am closing this issue as we have asked for a working example of the issue. I will gladly re-open the issue if you provide one.
const express = require('express') const cors = require('cors') const uuid = require('uuid') const youtube = require('youtube-api') const open = require('open') const multer = require('multer') const app = express() const fs = require('fs') const credentials = require('./credentials.json') app.use(express.json()) app.use(cors()) const storage = multer.diskStorage({ destination: './', filename(req, file, cb) { const newFileName =
${uuid()}-${file.originalname}`})
const uploadVideoFile = multer({ storage: storage }).single("videoFile") app.post('/upload', uploadVideoFile, (req, res) => { if(req.file){ const filename= req.file.filename; const {title, description} = req.body;
}) app.get('/oauth2callback', (req, res) => { res.redirect('http://localhost:5000/success') const {filename, title, description} = JSON.parse(req.query.state)
}) const oAuth = youtube.authenticate({ type: 'oauth', client_id: credentials.web.client_id, client_secret: credentials.web.client_secret, redirect_url: credentials.web.redirect_uris[0]
}) const PORT = 3000 app.listen(PORT)`
It keeps on giving me this when I try to make a request to my server from my react app,
MulterError: Unexpected field at wrappedFileFilter (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\multer\index.js:40:19) at Busboy. (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\multer\lib\make-middleware.js:114:7)
at Busboy.emit (events.js:310:20)
at Busboy.emit (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\busboy\lib\main.js:38:33)
at PartStream. (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\busboy\lib\types\multipart.js:213:13)
at PartStream.emit (events.js:310:20)
at HeaderParser. (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\dicer\lib\Dicer.js:51:16)
at HeaderParser.emit (events.js:310:20)
at HeaderParser._finish (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\dicer\lib\HeaderParser.js:68:8)
at SBMH. (C:\Users\Rushil Murikinati\Desktop\React App\main-backend\node_modules\dicer\lib\HeaderParser.js:40:12)