Getfilename GetExtension

Getfilename GetExtension

 Here is simple way to get file name or extension of the file at specified string.

you need to use System.IO namespace


 string path =  "";

string fileName  = System.IO.Path.GetFileName(path));

To get extension you can use GetExtension function

Now, you learned this technique hope you will use it instead of writting your own logic.

Tags: File UploadRequest Url


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.