I think it would be good that FileFormatInspector should have one more overload with File Extension as parameter wherein we can pass in the allowed extensions (".jpg, .txt, .xls, .doc, .pdf") in the application and it will check based on those extensions. The problem with File Format is that we have to use several if conditions to check for the allowed extensions (which are sometimes stored either in database or in configuration). Something like this:
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/models/file-uploads/samples/3.x/SampleApp/Utilities/FileHelpers.cs
I think it would be good that FileFormatInspector should have one more overload with File Extension as parameter wherein we can pass in the allowed extensions (".jpg, .txt, .xls, .doc, .pdf") in the application and it will check based on those extensions. The problem with File Format is that we have to use several if conditions to check for the allowed extensions (which are sometimes stored either in database or in configuration). Something like this:
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/models/file-uploads/samples/3.x/SampleApp/Utilities/FileHelpers.cs