javascript - req.body empty for textarea in http form (Using Express) -


i have following form have user upload file , submit text:

form(action='/createpost' enctype="multipart/form-data" method='post' id="imgform")     input(type='file' name='imgpath' size = "60")     br     textarea(name="posttext" form="imgform") enter post text here...     br     input(type='submit' value="submit") 

when run this:

router.post('/createpost', function(req,res){   console.log("post form body", req.body.posttext);   res.end(); }); 

i undefined in console. how value of input inside textarea?

try removing enctype="multipart/form-data" part in form , see if works. think servers interpret data sent in multipart differently.

i don't know if understand enctype="multipart/form-data" does, i'd use when uploading file form , node module multiparty


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -