Skip to content Skip to sidebar Skip to footer

How Can I Display An Image From The Local Machine On A Webpage

Here's the scenario: I have two machines on a LAN network. One of them is acting as a web server. When the second, client machine browser (Firefox) makes a request from the server,

Solution 1:

In most recent browsers, links to local files ( file:/// ) do not open, for security purposes. In your case, the browser does not display an image that resides on a file on your hard disk. This reason also explains why it works when you save your page locally.

Solution 2:

For starter, you need to add the runat="server" attribute.

If that doesn't suffice, then:

you should change

<imgsrc="http://localhost//file:/C:/Users/General/Desktop/map1.jpg"/>

to something like

<imgsrc="http://localhost/General/Desktop/map1.jpg"/>

or even better to

<imgsrc="~/General/Desktop/map1.jpg"/>

which targets the root of the application (you would need to move your image in that directory)

Solution 3:

A html page cannot request images from the client host. It must be stored on the server, or in another remote location.

Post a Comment for "How Can I Display An Image From The Local Machine On A Webpage"