mnamiri
asked on
fso.GetFolder(Server.MapPath()) returns full path, not relative path to image
Hi,
I am using rootFolder to get the path for images in a directory which i am displaying via ASP.
Set fso = Server.CreateObject("Scrip ting.FileS ystemObjec t")
Set rootFolder = fso.GetFolder(Server.MapPa th("images /thumbails /")) ' Here point to you folder.
Unfortunatley, i only just noticed that rootFolder returns the full path on the server. i.e. C:\inetsrv\wwwroot\website 1\images\t humbnails\
as opposed to a relative path to the asp page: \images\thumbnails
this results in lots of broken links when i load the page up in a browser a machine other than the server, because all the images are pointing to the whole C:\ path not the relative path for the images on the server.
Is there any clean way i can fix this?
thanks
I am using rootFolder to get the path for images in a directory which i am displaying via ASP.
Set fso = Server.CreateObject("Scrip
Set rootFolder = fso.GetFolder(Server.MapPa
Unfortunatley, i only just noticed that rootFolder returns the full path on the server. i.e. C:\inetsrv\wwwroot\website
as opposed to a relative path to the asp page: \images\thumbnails
this results in lots of broken links when i load the page up in a browser a machine other than the server, because all the images are pointing to the whole C:\ path not the relative path for the images on the server.
Is there any clean way i can fix this?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
FileSystemObject is a red herring here. You would be better off looking at the Request.ServerVariables collection to map ropor relative paths. Good article here:
http://www.4guysfromrolla.com/webtech/121799-1.shtml
http://www.4guysfromrolla.com/webtech/121799-1.shtml
ASKER
RelativePath = Replace(fso.GetFolder(Serv
and then just using the relative path wherever i need to...