Skip to content

Commit d33dbc4

Browse files
Merge pull request #2747 from mathewtrivett/support-multer-none
feat(express): add docs for proposed multer.none support
2 parents 4475111 + 2e79161 commit d33dbc4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

content/techniques/file-upload.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ uploadFile(files) {
236236
}
237237
```
238238

239+
#### No files
240+
241+
To accept `multipart/form-data` but not allow any files to be uploaded, use the `NoFilesInterceptor`. This sets multipart data as attributes on the request body. Any files sent with the request will throw a `BadRequestException`.
242+
243+
```typescript
244+
@Post('upload')
245+
@UseInterceptors(NoFilesInterceptor())
246+
handleMultiPartData(@Body() body) {
247+
console.log(body)
248+
}
249+
```
250+
239251
#### Default options
240252

241253
You can specify multer options in the file interceptors as described above. To set default options, you can call the static `register()` method when you import the `MulterModule`, passing in supported options. You can use all options listed [here](https://github.com/expressjs/multer#multeropts).

0 commit comments

Comments
 (0)