luca
luca

Reputation: 37136

src absolute path problem

I have an image in C:\wamp\www\site\img and i try to display it in a page with this:

<img src="C:\wamp\www\site\img\mypicture.jpg"/>

but it's not working.The file is actually there and if I try to refer to it with a relative path i got the picture

<img src="../img/mypicture.jpg">

where is the error?what am I missing?? thank you again guys!

Upvotes: 40

Views: 202881

Answers (5)

Madhusha Ravishani
Madhusha Ravishani

Reputation: 41

First open the image in any web browser. Then copy the path and add it as image source location like this :

src="file:///C:/wamp64/www/site/img/mypicture.jpg"

Upvotes: 1

forzagreen
forzagreen

Reputation: 2683

<img src="file://C:/wamp/www/site/img/mypicture.jpg"/>

Upvotes: 14

rlb.usa
rlb.usa

Reputation: 15043

You should be referencing it as localhost. Like this:

<img src="http:\\localhost\site\img\mypicture.jpg"/>

Upvotes: 18

leonbloy
leonbloy

Reputation: 75906

Use forward slashes. See explanation here

Upvotes: 2

Luke Duddridge
Luke Duddridge

Reputation: 4347

I think because C would be seen the C drive on the client pc, it wont let you. And if it could do this, it would be a big security hole.

Upvotes: 12

Related Questions