当我尝试在 nestjs 中上传带有一些附加数据邮递员 returns "Unexpected field","Bad Request" 的图像时

When I try to upload an image with some additional data postman returns "Unexpected field","Bad Request" in nestjs

我是一个自学者。当我尝试上传带有一些额外数据的图片时,邮递员 returns 这个错误...有人对此有任何想法吗..?

这是我的控制器方法:

 @Post()
  @UseInterceptors(FileInterceptor('file'))
  async create(
    @UploadedFile() file: Express.Multer.File,
    @Body() createItemDto: CreateItemDto,
  ) {
    console.log('item', createItemDto);
    console.log('file', file);
    // try {
    //   const item = await this.itemService.create(createItemDto);
    //   return {
    //     statusCode: HttpStatus.OK,
    //     message: 'Item created successfully',
    //     item,
    //   };
    // } catch (error) {
    //   return {
    //     message: error.detail,
    //   };
    // }
  }

我的 DTO:

根据 postman 请求,传递给 FileInterceptorfile 选项不正确。应该是 FileInterceptor('image') 而不是 FileInterceptor('file')