Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
The image from the form does not load

I am creating a website for each node.js/express. I made a form and it works well. However, when you add the line "enctype = "composite/form data", everything stops working (instead of the values of the input fields, "Avoid" is added to the database).

Handlebars:

    <form action="/target/" method="POST" enctype="multipart/form-data">
      <label for="name">Имя:</label>
        <input name="name"><br><br>
      <label for="age">Возраст:</label>
        <input name="age"><br><br>
      <label for="comm">Комментарий:</label>
      <input name="salary"><br><br>
      <label for="img">Картинка:</label>
      <input type="file" name="f">
        <input type="submit">
</form>

Node:

mongoClient.connect(async function(error, mongo) {
    if (!error) {
        let db = mongo.db('NODE_db');
        let coll = db.collection('users');
app.post('/target/', urlencodedParser, async function(req, res) {
            //Validation
            if (req.body.name == '' || req.body.age == '' || req.body.comm == ''){
                res.status(400).json({mess: "fill fields"})
            }
            else {
                await coll.insertOne(req.body);
                res.redirect('/')
            }
        });
} else {
    console.error(error);
}
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!