SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to truncate file directory in upload file control

    Hi

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

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    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?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •