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

126
Views
Why Multer destination is unused

I'm trying to save image from request.data. But I cant even test why it's not working.

Here is my code below. But I don't receive any errors, or console.log inside destination.

WebStorm IDE suggests that destination and filename properties are unused. But why?

const multer = require("multer");
const fs = require("fs");


const storage = multer.diskStorage({
    destination: function (req, file, cb) {
        console.log(req, file)
        const dir = 'public/upload';
        if(!fs.existsSync(dir)) {
            return fs.mkdir(dir, error => cb(error, dir));
        } else {
            return cb(null, dir);
        }
    },
    filename: function (req, file, cb) {
        cb(null, file.fieldname + '-' + Date.now());
    }
});

const upload = multer({ storage });

router.post("/createCatalogProduct", upload.single('data.image'), catalogController.createCatalogProduct)

enter image description here

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!