0👍
change route.js
const multerName = 'MyImage'
app.post('/api/images', parser.single(multerName), function(req, res){
mageUpload.js or imageUpload.vue or imageUpload.vue.jsx
const multerName = 'MyImage'
data.append("name", "orderImage");
here also same multerName as route.js
data.append("multerName", event.target.files[0]);
0👍
change route.js
const multerName = 'MyImage'
app.post('/api/images',
parser.single('anotherFile'), //here exact change
function(req, res){
after change
app.post('/api/images', parser.single('anotherFile'), function(req, res){
mageUpload.js or imageUpload.vue or imageUpload.vue.jsx
const multerName = 'MyImage'
data.append("name", "orderImage");
here also same multerName as route.js
data.append("file", //here exact change
event.target.files[0]);
After change
data.append("multerName", event.target.files[0]);
need to maintain same names in both frontend and backend formData()
Source:stackexchange.com