src absolute path problem

2019-01-06 16:22发布

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!

4条回答
你好瞎i
2楼-- · 2019-01-06 16:42

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

查看更多
太酷不给撩
3楼-- · 2019-01-06 16:45

Use forward slashes. See explanation here

查看更多
唯我独甜
4楼-- · 2019-01-06 16:46

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.

查看更多
我想做一个坏孩纸
5楼-- · 2019-01-06 17:02

You should be referencing it as localhost. Like this:

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

查看更多
登录 后发表回答