src absolute path problem

无人久伴 提交于 2019-11-26 09:39:37

问题


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!


回答1:


You should be referencing it as localhost. Like this:

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




回答2:


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.




回答3:


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




回答4:


Use forward slashes. See explanation here



来源:https://stackoverflow.com/questions/5157772/src-absolute-path-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!