FileInterceptor不起作用

时间:2018-08-16 12:53:59

标签: javascript nestjs

我在做什么错了?

@Post('upload')
@UseInterceptors(FileInterceptor('file'))
    async upload( @UploadedFile() file) {
      console.log(file)
    }

文件为undefined

postman

1 个答案:

答案 0 :(得分:0)

该代码在新项目中按预期工作。因此,依赖项已损坏。删除node_modules文件夹并运行npm install可解决此问题。