question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

req.files empty on nodejs 14

See original GitHub issue

I have a feeling this might be a nodejs 14 issue, maybe related to https://github.com/nodejs/node/issues/33050 not sure.

Same code works on node 12.x. On nodejs 14 req.files is just an empty object. Simple app to reproduce below.

const express = require('express')
const path = require('path')
const multi = require('connect-multiparty')
const multiMiddleware = multi();
const app = express()
const port = 3000

app.get('/', (req, res) => res.sendFile(path.resolve(__dirname, './index.html')))

app.post('/upload', multiMiddleware, function (req, res) {
    console.log('got upload', req.files);
    res.send('ok');
});

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:37 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
dougwilsoncommented, Jun 11, 2020

Hey @julianlam , @sw360cab , and everyone, sorry for the lack of updates; some life events occurred and I just got back into GitHub / open source things a couple days ago. I pretty much have all the fixes ready for this, and just working to get them published out asap. I am setting myself a timeline for this particular issue to be done by this weekend, if that helps.

2reactions
barisusaklicommented, Oct 1, 2020

@dougwilson can you bump the version to force the upgrade?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Express and Multer upload issue - req.files is always empty
My express form processing req.files giving me empty array or object for all the strategy i have tried. and my file field is...
Read more >
How to handle file upload in Expressjs - Educative.io
Step 1: Initiate the project. mkdir uploader && cd uploader npm init -y. The first line creates an empty directory and moves into...
Read more >
File uploads using Node.js - CodeForGeek
File upload in node.js seems tedious due to its async nature and network ... After completing upload , req.files variable holds following array...
Read more >
Express multer middleware
Accept an array of files, all with the name fieldname . Optionally error out if more than maxCount files are uploaded. The array...
Read more >
Errors | Node.js v19.3.0 Documentation
Error: Things keep happening! at /home/gbusey/file.js:525:2 at ... ENOTEMPTY (Directory not empty): A directory with entries was the target of an operation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found