expressjs / expressjs/multer

Uploaded multipart is undefined

Open
#974 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

I have tried using multer for uploading file and used Postman for testing endpoint. I have checked both header and name of file's attribute in form-data (which is the same both in the source code and Postman request).

```
import * as express from "express";
import * as multer from "multer";

const uploader = multer({
storage: multer.memoryStorage(),
limits: {
fileSize: 5 * 1024 * 1024, // keep images size < 5 MB
},
});

const router: express.IRouter = express.Router();

router.post("/upload",
uploader.single('file'),
async function (request: express.Request, response: express.Response) {
console.log("file",request.file);
console.log("files", request.files);
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.