I have this code:

<html><head><title></title></head><body><form id='formulario' action='index.html' method='post'><label>Ancho </label><input type='text' name='ancho' id='ancho'><br ><label>Alto </label><input type='text' name='alto' id='alto'><br ><label>Izquierda </label><input type='text' name='izquierda'  id='izquierda'><br ><label>Horizontales </label><input type='text' name='horizontal'  id='horizontal'<br ><label>Verticales</label><input type='text' name='vertical' id='vertical'><br  ><label>Crucero </label><input type='text' name='cruzero' id='cruzero'><br ><label>Marco </label><input type='checkbox' name='marco' id='marco'><br ><label><input type='radio' name='RadioGroup1' value='1'  id='piezas'>Piezas</label><br><label><input type='radio' name='RadioGroup1'  value='0' id='medidas'>Medidas</label><br><input type='submit' value='Enviar'></p></form><img src='c:\archivo1.jpg' width='500' height='500'></body></html>

It doesnt work (doesnt show the image) if I save it as a .html file but if I try it in my Java IDE (MyEclipse) perfect...

No sense at all and its driving me nuts.

Anything?

Your image is displaying inside your IDE because the IDE is smart enough to know that you want to see a specific file in that specific place. My suggestion would be...

1. Create a folder to work on your web page or pages...you can call it HTML_WORK
2. Move your html file/files inside that folder
3. Create another folder inside your HTML_WORK folder called IMAGES
4. Copy or Move your image from c:\ to the IMAGES folder
5. Change your line from this ... <img src='c:\archivo1.jpg' width='500' height='500'></'> ... to this .... <img src='images/archivo1.jpg' width='500' height='500' />

That should give you what you are looking for.

The reason the browser cannot find the image is because it needs to know where to find the image based on the file that is calling it. Your IDE can see it in C:\ ....your web browser cannot.

Your image is displaying inside your IDE because the IDE is smart enough to know that you want to see a specific file in that specific place. My suggestion would be...

1. Create a folder to work on your web page or pages...you can call it HTML_WORK
2. Move your html file/files inside that folder
3. Create another folder inside your HTML_WORK folder called IMAGES
4. Copy or Move your image from c:\ to the IMAGES folder
5. Change your line from this ... <img src='c:\archivo1.jpg' width='500' height='500'></'> ... to this .... <img src='images/archivo1.jpg' width='500' height='500' />

That should give you what you are looking for.

The reason the browser cannot find the image is because it needs to know where to find the image based on the file that is calling it. Your IDE can see it in C:\ ....your web browser cannot.

I need to to work from C: first because this is actually from a Java servlet (complicated)> Once I get it to work there, then I can move on and implant it in my Java code.

First I need this HTML to work as is......No Java involved at all. So making a workcenter with folders is right now out of the question....

Ok...so where is your HTML file located? You may need to set the source of your image file to be "../../archivo1.jpg" ( or however many directories you need to move up ).

Ok...so where is your HTML file located? You may need to set the source of your image file to be "../../archivo1.jpg" ( or however many directories you need to move up ).

The image is on C: and the HTML file is (I believe):

C:/dir/dir/dir/dir/dir

I believe.......Ill have to confirm that.

But I cant directly link to C:/file.jpg , no matter where the HTML file is?

No, you can't link to it using the C:\ ... I would recommend either putting the image in a directory closer, but you can also use the "../" in front of the filename. Use one of those for every directory you need to back out.

example: if the image is in the root of C:\file.jpg ... and the HTML file is in C:\dir\dir\dir\dir\dir\file.html ... I would set the <img src="../../../../../file.jpg" />

I have this code:

<html><head><title></title></head><body><form id='formulario' action='index.html' method='post'><label>Ancho </label><input type='text' name='ancho' id='ancho'><br ><label>Alto </label><input type='text' name='alto' id='alto'><br ><label>Izquierda </label><input type='text' name='izquierda'  id='izquierda'><br ><label>Horizontales </label><input type='text' name='horizontal'  id='horizontal'<br ><label>Verticales</label><input type='text' name='vertical' id='vertical'><br  ><label>Crucero </label><input type='text' name='cruzero' id='cruzero'><br ><label>Marco </label><input type='checkbox' name='marco' id='marco'><br ><label><input type='radio' name='RadioGroup1' value='1'  id='piezas'>Piezas</label><br><label><input type='radio' name='RadioGroup1'  value='0' id='medidas'>Medidas</label><br><input type='submit' value='Enviar'></p></form><img src='c:\archivo1.jpg' width='500' height='500'></body></html>

It doesnt work (doesnt show the image) if I save it as a .html file but if I try it in my Java IDE (MyEclipse) perfect...

No sense at all and its driving me nuts.

Anything?

!Your working code here:

<img src=file:/C:/archivo1.jpg>

----------
(-Why?)
*Firefox doesn't recognize file system paths

With no ' ' ?

Still nothing...

With ' ', stil nothing....

That's not true, it works perfectly on all browsers -something else you're doing wrong there.
Seriously without " " indeed!
{Of course if you are coding in HTML, (because you obviously are) and not declaring your document as something that it is not, (xhtml for instance).}

In HTML
Element properties do not require string literals for their property values.

Required property values in HTML[5] are tokens.
Attention: if the property value contains characters that are able to break the token into fragments, [a white-space comes to mind] the " " (string literal) can be used, - and is to be used as a guard!

Note: even the " " guard can be broken by certain white-space character.

Therefore the <img src=file:/c:/archivo1.jpg width=500 height=500></'> conforms HTML5 Strict. The part in red is an error.

A more stict location format protocol would be file://c:/filename.ext, this is how you should normally use it even if that's not going to be used in your final product.

Otherwise, -your original code will work locally with no problem if using Chrome or IE*, but you are debugging in Firefox. Therefore specifying the file protocol is required literally and in literal.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.