- Lucas' Newsletter
- Posts
- NestJS File Upload Multiple File Type Verification
NestJS File Upload Multiple File Type Verification
![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,format=auto,onerror=redirect,quality=80/uploads/asset/file/b7eda359-4646-48a3-b05f-f7224403b588/photo-1523800503107-5bc3ba2a6f81.jpeg?t=1722263310)
Photo by Oskar Yildiz / Unsplash
I had this problem limiting the types of files going to the backend using Nestjs.
So I built a custom validator, here's how it looks:
And here's how I use it in my Controller class:
Pretty neat hm?
Like what you see? Check out my projects and my youtube channel, or give me a thanks on Twitter.