In this recipe, we will create a file upload service that restricts allowed media types to a predefined whitelist. This will be done by using a request filter attribute and applying it to a service that handles file uploading.
If you are using a non-express version of Visual Studio, you can start this recipe using ServiceStackVS and create a project based on ServiceStack ASP.NET with the Bootstrap template or one of the others that supports Razor by default. If you are using an express version of Visual Studio, please follow Creating a ServiceStack solution with Visual Studio and NuGet in Appendix A, Getting Started and start from the second instruction in the How to do it... section that is follows.