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
601 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
1,157 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
2,423 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, 2022 in C# by rajiv
• 1,620 points
666 views
0 votes
1 answer

Is a Library a project or a C# source code file in Visual Studio?

A library project is a collection of ...READ MORE

answered Jun 7, 2022 in C# by rajiv
• 1,620 points
459 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, 2022 in Other DevOps Questions by Kichu
• 19,050 points
654 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, 2022 in C# by rajiv
• 1,620 points
554 views
0 votes
1 answer

Get Excel data in DataTable

The JET/Access driver has a number of ...READ MORE

answered Nov 10, 2022 in Others by narikkadan
• 63,680 points
1,560 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,140 points
5,681 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, 2022 in C# by jyoti
• 1,240 points
408 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, 2022 in C# by jyoti
• 1,240 points
1,463 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP