richardgirges / express-fileupload

Simple express file upload middleware that wraps around busboy
MIT License
1.52k stars 261 forks source link

req.files is undefined #242

Closed SkyLineBot closed 4 years ago

SkyLineBot commented 4 years ago

Hi!

I try to use this package but when I use req.files that's send undefined.

My code:


.post("/upload", require('../../auth/CheckAuth'), async function(req, res) {
    console.log(req.files) //send undefined
    await res.redirect(`/profile`);
});

In server.js:
.use(fileUpload({
    createParentPath: true,
    limits: { 
        fileSize: 5 * 1024 * 1024 * 1024
    }
}))
westofer commented 4 years ago

@SkyLineBot did you manage to fix it? :(

SkyLineBot commented 3 years ago

@westofer yes

westofer commented 3 years ago

@SkyLineBot Thanks. I stopped the project :)

PavelJacobo commented 3 years ago

How did You fix It?

JulienPlanchetCoineo commented 3 years ago

If you are using a router for MVC Express, instead of app.use(fileUpload()), do router.use(fileUpload()).