How to Validate the File Type of a File Using C# (Simple)

preview_player
Показать описание
How to Validate a File Type with a File Name Extension in C# (Simple)

Greetings, today we are going to be looking at how we can validate the file type of a file using C#. This is a simple method but is not bulletproof. If someone wants to upload an invalid file type, they can. This is more useful to stop accidental uploads or inform users who made a mistake with uploading a file.

This tutorial will not cover how to upload a file, just how to validate the file type using the name of the file. We can check the extension to determine the file type with some simple string manipulation. I also include how to check if a file exists incase that is something you also want.

How to Validate a File Type with a File Name Extension in C# (Simple)
Рекомендации по теме
welcome to shbcf.ru