Nodejs uses multer to implement the file upload front-end request report 404, but the picture has been uploaded successfully.

the front end requests to report 404, but the backend confirms that the file can be received

.

Code in node service server.js

var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, "./upload");
  },
  filename: function (req, file, cb) {
    let pointIndex = file.originalname.indexOf(".")
    let name = file.originalname.slice(0, pointIndex)
    let filename = file.originalname.slice(pointIndex)
    cb(null, name + "-" + (Math.random() * 100000000000000000) + filename);
  }
})
var upload = multer({
  storage: storage
})

router.post("/upload", upload.array("file[]", 9), function (err, req, res, next) {
  console.log(err)
  res.send({
    code: 200,
    msg: ""
  })
})

do you use other global middleware?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4359d-43505.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4359d-43505.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?