Skip to content

Instantly share code, notes, and snippets.

@GoodnessEzeokafor
Created September 4, 2024 16:49
Show Gist options
  • Save GoodnessEzeokafor/acccb544ca8bd43062f1b6cdbcc562db to your computer and use it in GitHub Desktop.
Save GoodnessEzeokafor/acccb544ca8bd43062f1b6cdbcc562db to your computer and use it in GitHub Desktop.
Differences Between @uploadedfile() and @uploadedfiles()
// Use @UploadedFile() when uploading a single file/video/image
@Post('/upload-file')
@UseInterceptors(FileInterceptor('video'))
async createCheckedIn(
@UploadedFile() file: Express.Multer.File,
@Res() res: Response,
) {}
// use @UploadedFiles() when uploading multiple file/video/images
@Post('/upload-files')
@UseInterceptors(FilesInterceptor('images'))
async addProduct(
@UploadedFiles() files: Express.Multer.File[],
@Res() res: Response,
) {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment