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 in C# by pranav
• 2,580 points
26 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 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 in C# by krishna
• 2,540 points
12 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 in C# by pranav
• 2,580 points
52 views
0 votes
1 answer

What are the differences between C, C# and C++ in terms of real-world applications?

C is a bare-bones, straightforward, and clean ...READ MORE

answered May 30 in C# by rajiv
• 1,620 points
29 views
0 votes
1 answer
0 votes
0 answers

Azure function to read file from azure devops repository

I want my azure function to read ...READ MORE

Mar 28 in Other DevOps Questions by Kichu
• 19,040 points
25 views
0 votes
1 answer

What extensions are there for generated C# files

This is by no means complete, but ...READ MORE

answered Jun 9 in C# by rajiv
• 1,620 points
18 views
0 votes
3 answers

Trying to upload files using Selenium(C#)

You can try using Javascript Executor to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,120 points
4,510 views
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
516 views
0 votes
1 answer

How to enumerate an enum

foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { } Note that ...READ MORE

answered Jun 14 in C# by jyoti
• 1,240 points
16 views
0 votes
1 answer

How to get substring from string containing newlines

If you want to maintain the newline ...READ MORE

answered Jun 14 in C# by jyoti
• 1,240 points
19 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP