How to truncate file directory in upload file control


Just want to as is thire a way to truncate full Directory like “C:\Project\ProjectName\img\image1.jpg” to “img/image1.jpg”

Yes, you should be able to replace MapPath(“/”) with “” on the string above. That should do what you need.

string path = path.Replace(MapPath(“/”),“”);

Out of curiosity. Why would you want to do something like that?