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

315
Views
Multer doesn't save the file to the web server

Hey I'm trying to use multer to save files on the web server but it doesn't work.

I tried every answer on stack overflow but nothing solves it. No error it just doesn't work. I tried running it both locally and on Openshift.

Here's the relevant lines from my code.
Client side:

<form id="upload_form" method="POST" action="/submit_upload" enctype="multipart/form-data">
  <input type="text" id="name" name="name"><br>
  <input type="file" id="software" name="software"><br>
  <input type="submit" value="Upload">
</form>

Server side:

const express = require("express");
const multer = require("multer");
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended = true }));
var storage = multer.diskStorage({
    destination: "uploads/",
    filename: function(req, file, cb) {
        cb(null, file.fieldname);
    }
});
var upload = multer({ storage: storage, limits: { fieldSize: 10 * 1024 * 1024 } }).single("software");
app.post("/submit_upload", upload, function(req, res) {
    console.log(req.body); // is alright
    console.log(req.file); // undefined
}
app.listen(8080, function() { console.log("started"); });
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!