Convert Physical path to Virtual path?

S

Scott Tilton

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
http://www.ourwebsite/images.

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
(e-mail address removed) or (e-mail address removed)
www.avantekservices.com or www.avsv.com

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

** Support Cancer Research: http://www.rosepedal2003.com **
 
A

Aaron Bertrand - MVP

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

Dhananjay Modak

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top