W
W
WebLedNik2021-10-07 16:24:46
Express.js
WebLedNik, 2021-10-07 16:24:46

Why does the Node.Js server hang when using Multer upload?

Problem essence:
I send through formData files of images on the server.
To work with files I use the Multer library.
Everything works fine until I upload files larger than 50kb. After that, the server does not process the request. This does not generate an error. On the client, this looks like a long load with the result of a long response error.

const storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, './static/img/products/')
  },
  filename: function (req, file, cb) {
    cb(null, file.fieldname + '-' + Date.now())
  }
})

const uploadProduct = multer({storage}).array('photos', 10)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question