Reputation:
Basically this question except i am using ASP.NET. How do i take a given file and check if it is
The solution does not need to check all of these but if i can get a few to check all of these then great.
Upvotes: 0
Views: 3804
Reputation: 134227
You can try to either:
For example, here is an example of how to verify an image file: validate-image-from-file-in-c#
Of course, the mime type and/or file extension can give you a good guess of what file format you are dealing with, but (depending on the source) you should not rely on it exclusively.
Upvotes: 2
Reputation: 6879
Given the variety of your file types, checking the extension may be the best option. Anyone has other thoughts?
Upvotes: 1