Heya - I assume that this is either not documented well or I am just not skilled enough to solve it. Using the FileFieldsInterceptor in combination with @UploadedFiles as documented and applying a ParseFilePipe instance to it, the validation fails every time. Debugging this shows that the single validators do not receive a file at all and thus every check fails. Any hints on how to implement it? 🙂
My expectation is, that the validation pipe is applied to each file in the request.
UPDATE - seems to be related to: https://github.com/nestjs/docs.nestjs.com/issues/2424
@Post('upload')
@UseInterceptors(
FileFieldsInterceptor([
{ name: 'frontImage', maxCount: 1 },
{ name: 'backImage', maxCount: 1 },
]),
)
async uploadFile(
@UploadedFiles(new ParseFilePipe({
fileIsRequired: true,
validators: [
new MaxFileSizeValidator({ maxSize: 1024 * 1024 * 20 }),
new FileTypeValidator({
fileType: /^image\/(png|jp(e)?g)$/,
}),
],
}))
files: {
frontImage?: Express.Multer.File[];
backImage?: Express.Multer.File[];
},
) {
this.logger.debug(files.frontImage?.at(0)?.mimetype);
Is there an existing issue that is already proposing this? I have searched the existing issues Is your feature request related to a problem? Please describe it When using FilesInterceptor for doing...