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,320 points
16 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
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,320 points
20 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
21 views
0 votes
1 answer
0 votes
1 answer

Encapsulation of subclasses from a constructor in C#

If you think about it in terms ...READ MORE

answered Jun 11 in C# by pranav
• 2,320 points
11 views
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
23 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
7 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,100 points
4,468 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
499 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
9 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
8 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