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

68
Views
Sending image and additional info via HTTP

I want to send and image AND other text information, I saw that for the image I need to use enctype="multipart/form-data" in the form. But doing this make me unable to see the other information needed.

 <form action="/new" enctype="multipart/form-data" method="post">
      <input type="text" id="name" value=""/>
      <input type="file" name="image" accept="image/*"  value="Compagny Logo"/>
      <input type="submit" value="Load compagny"/>
</form>

var storage = multer.diskStorage({
    destination: (req, file, callBack) => {
        callBack(null, './public/images/')
    },
    filename: (req, file, callBack) => {
        callBack(null, file.fieldname + '-' + Date.now() + path.extname(file.originalname))
    }
})
 
var upload = multer({
    storage: storage
});

router.post("/new", upload.single('image'), (req, res) => {
        console.log(req.file.filename) // work
        console.log(req.name) // does'nt work
    }
});

Is there and other enctype I need to use ?

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!