Local file reference

E

Edward

I'm creating and testing basic web pages, and learning HTML.
How do you refer an image source or a link to a local file.jpg for example?
I've tried <img src="C:\image.jpg" align="center"/> without success. The
only way my web page will see files when testing is to load them on my
actual web server.
<img src="http://www.domain.com/image.jpg" align="center" />

Thanks
 
S

Spartanicus

Edward said:
I'm creating and testing basic web pages, and learning HTML.
How do you refer an image source or a link to a local file.jpg for example?

file://localhost/C:/image.jpg

But since you claim to be building a *web* page, you will be the only
one to see it.
 
E

Edward

Very true.
Until its polished, and working, and has a web server on which to reside,
and not on my local pc.

Thanks
 
D

David Dorward

Edward said:
I'm creating and testing basic web pages, and learning HTML.
How do you refer an image source or a link to a local file.jpg for
example?

Absolute URLs? Depends on the browser and OS. You're almost certainly best
off using relative URLs ...

http://www.iusmentis.com/technology/www/relativeurls/

.... , or installing a webserver on your workstation ...

http://httpd.apache.org/
I've tried <img src="C:\image.jpg" align="center"/> without success.

Aside from the issues of how absolute URLs to local file systems are
handled, the "align" attribute is deprecated and should not be used, the
alt attribute (which you don't have) is required, and Appendix C of the
XHTML 1.0 spec requires a space before the "/" (although XHTML is not
usually a good idea and you would be better off sticking to HTML 4.01).
 
K

Ken

Hi Edward -

I'm creating and testing basic web pages, and learning HTML.
How do you refer an image source or a link to a local file.jpg for example?
I've tried <img src="C:\image.jpg" align="center"/> without success. The
only way my web page will see files when testing is to load them on my
actual web server.
<img src="http://www.domain.com/image.jpg" align="center" />

src="image.jpg"

If the page is in c:\ the browser will look for c:\image.jpg

If the page is in http://www.example.com/ the browser will look for
http://www.example.com/image.jpg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top