You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/techniques/file-upload.md
+13
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,19 @@ export class FileSizeValidationPipe implements PipeTransform {
58
58
}
59
59
```
60
60
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
+
newFileSizeValidationPipe(),
68
+
// other pipes can be added here
69
+
) file: Express.Multer.File, ) {
70
+
returnfile;
71
+
}
72
+
```
73
+
61
74
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:
0 commit comments