How to find the extension of a file in C

0 votes
I'm uploading video files to a page in my web application (ASP.NET, C#), however I only want to upload flv videos. When I upload other extension movies, how can I set a limit?
Jun 11, 2022 in C# by pranav
• 2,590 points
• 2,433 views

1 answer to this question.

0 votes

Go to here https://docs.microsoft.com/en-us/dotnet/api/system.io.path.getextension?redirectedfrom=MSDN&view=net-6.0#System_IO_Path_GetExtension_System_String_

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

And that is it!

answered Jun 21, 2022 by jyoti
• 1,240 points

Related Questions In C#

0 votes
0 answers

How to add a gridview to a C# winforms project with a list of objects as the datasource

In Visual Studio 2015 community, I'm creating ...READ MORE

Jun 11, 2022 in C# by krishna
• 2,820 points
• 2,620 views
0 votes
1 answer

How do I specify the exit code of a console application in .NET

Simply put, you can return the exit ...READ MORE

answered Jun 11, 2022 in C# by pranav
• 2,590 points
• 4,727 views
0 votes
1 answer