Skip to content
Advertisement

FileInterceptor doesn’t work

What am I doing wrong?

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

file is undefined

postman

Advertisement

Answer

The code works as expected in a fresh project. Hence, the dependencies are corrupt. Deleting the node_modules folder and running npm install solves the problem.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement