Why does it issue an undefined?

24 views Asked by At

At the moment when I make a POST request for the endpoint/upload, I get an incomplete search, but I have to output a file to the console.

I tried to send a request from the front (there may be a problem with the key), but nothing has changed.

Controller:

    @HttpCode(200)
    @Post('upload')
    @UseInterceptors(
        FileInterceptor('photo', {
            storage: diskStorage({
                destination: './uploads',
                filename: (req, file, cb) => {
                    cb(null, `${file.originalname}`)
                },
            }),
        })
    )
    uploadFile(@UploadedFile() file: Express.Multer.File) {
        if (file === undefined) throw new BadRequestException('Не найдено!')
        console.log(file)
    }
}
0

There are 0 answers