"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Friday, May 6, 2011

Getting File type or Getting file extension

 Getting File type or Getting file extension is done by some many ways a few is listed here ::-
  • string fileExtension = System.IO.Path.GetExtension(@"C:\MyFolder\MyFile.jpg"
  • System.IO.FileInfo f = new System.IO.FileInfo(Server.MapPath("~/MyFolder/MyFile.jpg"));
    string extension = f.Extension;
 Over here i prefer the second method.

Stay tune...
Have a nice day... 'N happy Coding :)

No comments: