Surya sasidhar Surya sasidhar - 27 days ago 8
ASP.NET (C#) Question

How to find extension of a file?

in my web application (asp.net,c#) i am uploading video file in a page but i want to upload only flv videos. how can i restrict when i upload other extension videos help me please.

Answer

Path.GetExtension

string myFilePath = @"C:\MyFile.txt";
string ext = Path.GetExtension(myFilePath);
// ext would be ".txt"
Comments