Skip to content

Commit c2ec8a0

Browse files
Merge branch 'gyanendrasng-update-file-validation-docs'
2 parents e014e7e + e65cb48 commit c2ec8a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

content/techniques/file-upload.md

+13
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ export class FileSizeValidationPipe implements PipeTransform {
5858
}
5959
```
6060

61+
This can be used in conjunction with the `FileInterceptor` as follows:
62+
63+
```typescript
64+
@Post('file')
65+
@UseInterceptors(FileInterceptor('file'))
66+
uploadFileAndValidate(@UploadedFile(
67+
new FileSizeValidationPipe(),
68+
// other pipes can be added here
69+
) file: Express.Multer.File, ) {
70+
return file;
71+
}
72+
```
73+
6174
Nest provides a built-in pipe to handle common use cases and facilitate/standardize the addition of new ones. This pipe is called `ParseFilePipe`, and you can use it as follows:
6275

6376
```typescript

0 commit comments

Comments
 (0)