I'm following the nestjs documentation for File upload, my endpoint is getting the file, but the file is not stored.
I'm using the same configuration than NesJS
@Post('upload')
@UseInterceptors(FileInterceptor('file'))
uploadFile(@UploadedFile() file) {
console.log(file);
}
My app.module file, I added the import for:
MulterModule.register({
dest: './uploads'
})
But the file is not stored in the directory uploads. The complete log is:
undefined
{
fieldname: 'file',
originalname: 'nopornimage.png',
encoding: '7bit',
mimetype: 'image/png',
buffer: <Buffer 89 50 4e 47 0d 0a 1a 04 d00 01 73 52 47 42 00 ae ce 04 ... 20087 more bytes>,
size: 20137
}
(Yes, including the undefined)
What am I doing wrong?