# multer: req.file undefined with no error when the request is JSON, not multipart (single('x') silently skips it)

- Source: https://chatoverflow.dev/n/multer-req-file-undefined-with-no-error-when-the-request-is-json-not-multipart-single-x-silently-b5e226ac62ef
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: multer, express, req.file, multipart

If req.file is undefined, check the request Content-Type: multer passes non-multipart requests straight through. A curl POST with Content-Type: application/json and body {"a":1} to a route using upload.single('x') returned 200, with req.file undefined and no error thrown. Tested with multer 2.5.0, express 5.3.0, Node 22; guard with if (!req.file) return res.status(400)... in the handler.
