Convert Physical path to Virtual path?

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Convert Physical path to Virtual path?

    We have a field that gets filled into a database that our ASP website pulls
    from. What we would like to be able to do is to take that path and convert
    it to a virtual path so the website can display the image. We have setup
    with our website a virtual directory for: "g:\quotewerks\images\" which is
    [url]http://www.ourwebsite/images[/url].

    So, below you can see the data we pull from the field in the database, and
    what I need it to look like. Can anyone help me out with the code to do
    this?

    From database:

    q:\quotewerks\images\contact systems\contac3s.jpg
    q:\quotewerks\images\fuji\cp6-5 cal\mvc-012f(2).jpg
    q:\quotewerks\images\front emerald.jpg

    Needs to be changed to:

    /images/contact systems/contac3s.jpg
    /images/fuji/cp6-5 cal/mvc-012f(2).jpg
    /images/front emerald.jpg


    Any help would be great, thanks!

    Best Regards,

    Scott B. Tilton

    Avantek Services
    Phone: (603)742-1333 Ext. 26
    Fax: (603)299-0323
    [email]stilton@avantekservices.com[/email] or [email]stilton@avsv.com[/email]
    [url]www.avantekservices.com[/url] or [url]www.avsv.com[/url]

    "A focused mind is the ultimate weapon." - Unknown

    ** Support Cancer Research: [url]http://www.rosepedal2003.com[/url] **


    Scott Tilton Guest

  2. Similar Questions and Discussions

    1. Retrieving physical path on the server
      Hi everyone, this is my first message on a macromedia forum, so I hope I've choosen the right forum... if not, please tell me :) My problem is...
    2. Virtual Path
      Hi, I have an application with a connection.asp document linking to the MS Access database Previously I have had the database ABOVE the ROOT and...
    3. finding the physical path of an include file when parsing
      How do I find the path to an include file from inside the file when loaded? The file is located above the doc root. The script which includes the...
    4. Convert text path back to regular path
      Im sure this has been covereed beofre , but I want to take an oddly shaped pathy that I have converted to a text path, and revert it to a regualr...
    5. virtual path problem
      hi, I have a script in a folder which simply creates a file in another dump folder /myscript/script.php /myscript/dumpfolder/ but then i...
  3. #2

    Default Re: Convert Physical path to Virtual path?

    path = "q:\quotewerks\images\front emerald.jpg"
    path = replace(replace(path, "q:\quoteworks", ""), "\", "/")
    response.write path


    "Scott Tilton" <stilton@avantekservices.com> wrote in message
    news:OgJek47RDHA.3192@TK2MSFTNGP10.phx.gbl...
    > We have a field that gets filled into a database that our ASP website
    pulls
    > from. What we would like to be able to do is to take that path and
    convert
    > it to a virtual path so the website can display the image. We have setup
    > with our website a virtual directory for: "g:\quotewerks\images\" which
    is
    > [url]http://www.ourwebsite/images[/url].
    >
    > So, below you can see the data we pull from the field in the database, and
    > what I need it to look like. Can anyone help me out with the code to do
    > this?
    >
    > From database:
    >
    > q:\quotewerks\images\contact systems\contac3s.jpg
    > q:\quotewerks\images\fuji\cp6-5 cal\mvc-012f(2).jpg
    > q:\quotewerks\images\front emerald.jpg
    >
    > Needs to be changed to:
    >
    > /images/contact systems/contac3s.jpg
    > /images/fuji/cp6-5 cal/mvc-012f(2).jpg
    > /images/front emerald.jpg
    >
    >
    > Any help would be great, thanks!
    >
    > Best Regards,
    >
    > Scott B. Tilton
    >
    > Avantek Services
    > Phone: (603)742-1333 Ext. 26
    > Fax: (603)299-0323
    > [email]stilton@avantekservices.com[/email] or [email]stilton@avsv.com[/email]
    > [url]www.avantekservices.com[/url] or [url]www.avsv.com[/url]
    >
    > "A focused mind is the ultimate weapon." - Unknown
    >
    > ** Support Cancer Research: [url]http://www.rosepedal2003.com[/url] **
    >
    >

    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: Convert Physical path to Virtual path?

    One way is:
    - read physical path
    - use combination of mid and instr functions to find the 2nd slash
    - cut the string at the 2nd slash (assumption: first directory is the root
    of the web site)

    cheers
    Dhananjay

    "Scott Tilton" <stilton@avantekservices.com> wrote in message
    news:OgJek47RDHA.3192@TK2MSFTNGP10.phx.gbl...
    > We have a field that gets filled into a database that our ASP website
    pulls
    > from. What we would like to be able to do is to take that path and
    convert
    > it to a virtual path so the website can display the image. We have setup
    > with our website a virtual directory for: "g:\quotewerks\images\" which
    is
    > [url]http://www.ourwebsite/images[/url].
    >
    > So, below you can see the data we pull from the field in the database, and
    > what I need it to look like. Can anyone help me out with the code to do
    > this?
    >
    > From database:
    >
    > q:\quotewerks\images\contact systems\contac3s.jpg
    > q:\quotewerks\images\fuji\cp6-5 cal\mvc-012f(2).jpg
    > q:\quotewerks\images\front emerald.jpg
    >
    > Needs to be changed to:
    >
    > /images/contact systems/contac3s.jpg
    > /images/fuji/cp6-5 cal/mvc-012f(2).jpg
    > /images/front emerald.jpg
    >
    >
    > Any help would be great, thanks!
    >
    > Best Regards,
    >
    > Scott B. Tilton
    >
    > Avantek Services
    > Phone: (603)742-1333 Ext. 26
    > Fax: (603)299-0323
    > [email]stilton@avantekservices.com[/email] or [email]stilton@avsv.com[/email]
    > [url]www.avantekservices.com[/url] or [url]www.avsv.com[/url]
    >
    > "A focused mind is the ultimate weapon." - Unknown
    >
    > ** Support Cancer Research: [url]http://www.rosepedal2003.com[/url] **
    >
    >

    Dhananjay Modak Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139