Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server.MapPath 1

Status
Not open for further replies.

TRACEYMARYLAND

Programmer
Joined
May 21, 2004
Messages
370
Location
US
Hi i never used this before but my directory is as follows

C:\TEST\ASP
mypage.asp
C:\TEST\images

in mypage.asp that runs from i want to include an image that is from images directory.

How do i code in the server.map path

Server.MapPath("images/tvi.Jpg")
this did not work...

Thanks
 
are you trying to display the image on page? or show a list of images in that folder.

if you're display an image, then you don't need to map a path just use the
Code:
<img src="../images/whatever.jpg">
if you are showing a list, then in conjunction with the FSO objects it would be
Code:
Server.MapPath("../images/")

hope that helps abit!
 
Try either:
Server.MapPath("../images/tvi.jpg")
or
Server.MapPath("/Test/images/tvi.jpg")

The first method uses a virtual path based on the current directory (localhost/Test/ASP/mypage.asp) the second uses a virtual directory based on the root path of the web server.

On a side note, it is a very bad idea to make C:\ a virtual web directory because if someone finds out they can easily get any and every file from your computer, leaving you wide open to be thoroughly hacked. I can think of several things that would leave you wide open (configuation files being available) by being available.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top