I need to check whether an upload file a csv or not with out checking the file extension. Using filecontent property also i can't find the type efficiently if a non-csv file is renamed to ".csv" extension. I need to prevent such things from happening.
Any one please suggest a method to find the content type by reading header info..
The only way to do this is to parse the file as CSV - if it parses OK, it is CSV, if not, it isn't.
You could use a parser such as the TextFieldParser
class that is part of the Microsoft.VisualBasic.Text
namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With