In my c# code when I used Path.GetExtension , It is showing "Path does not exist in current context". Seems libraries for Path does not exist in current application. But I searched and found Path class defined in System.IO and System.IO is by default part of our application. After included System.IO the error exist.
You need to add namespace
using System.IO;
And your path should be :
string str= Path.GetExtension(FileUpload1.PostedFile.FileName);
Second way :
string str= System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName);
Then it will work.
Cheers !!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With