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

290
Views
files.fileName.path returns undefined in formidable

The file is not saved on the server. The path property returns undefined.

const uploadProfile = (req, res) => {
  const form = formidable.IncomingForm();

  form.uploadDir = `./images`;
  form.keepExtensions = true;
  form.parse(req, (err, fields, files) => {
    if (err) {
      return res.json("Formidable cannot parse the form");
    }

    console.log(files.image.path);
   res.json(files.image.path);
  });
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const uploadProfile = (req, res) => {

    const options = {
    uploadDir: `./images`,
    keepExtensions: true,
  };

  const form = new formidable.IncomingForm(options);

  form.parse(req, (err, fields, files) => {
    if (err) {
      return res.json("Formidable cannot parse the form");
    }

    const {filepath, originalFilename, newFilename, size , mimetype} = files.image
    //'image' is the fileName... files.fileName 
    console.log(newFilename, "...");
   
    res.json(newFilename);
  });
};

Read about migration from V1 to V2 or V3

about 4 years ago · Juan Pablo Isaza Report
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!