jonjenkins / express-upload

express-upload: node.js, express, multer, html5 progress upload example
64 stars 14 forks source link

req.files is undefined #1

Open sihao1234 opened 10 years ago

sihao1234 commented 10 years ago

I've tried numbers of times, but the result of console.log(req.body); console.log(req.files); is: {} undefined

if I remove the enctype="multipart/form-data" of the form, console.log(req.body); console.log(req.files); is { thumbnail: 'w.txt' } undefined

(thumbnail is the name of the input file element)

what I'm using is Windows OS nodejs 0.10.24 express 3.4.8 and have tried express 3.5.4 and ejs module

Do you think that's the problem of the version? Do you think that's the problem of the unicode?(I'm using UTF-8) Do you think there're still some error in the code?

Thank you very much for you help!

sihao1234 commented 10 years ago

Sorry, I found the reason:

app.use(express.bodyParser({uploadDir:'./tmp'})); //Must be put before app.use(app.router); app.use(app.router);

jonjenkins commented 10 years ago

No problem. Glad you got it figured out.

On Tue, Jun 10, 2014 at 6:18 PM, Sihao Feng notifications@github.com wrote:

Sorry, I found the reason:

app.use(express.bodyParser({uploadDir:'./tmp'})); //Must be put before app.use(app.router); app.use(app.router);

— Reply to this email directly or view it on GitHub https://github.com/jonjenkins/express-upload/issues/1#issuecomment-45688473 .