Hy all,

i use the following code for displaying the image. i am sending the image file from the my HTML page...

the following code is working for the image having name without any space example like:-test1.jpeg, but the following code is not working when i send the image having name with space.. example like:- test data.jpeg, data d1.jpeg.

can anyone help me to solve the above problem...?

out.println("File has been uploaded successfully");
		out.println("<html>");
		out.println("<body>");
		out.println("<table><tr><td width='210'></td><td> <img border=2 src=image/"+itemName.toString().trim()+" width=800 height=600></td></tr></table>");
		out.println("</body>");
		out.println("</html>");

Thanks
Yatin

USE SINGLE QUOTE AROUND SRC attribute

out.println("File has been uploaded successfully");
		out.println("<html>");
		out.println("<body>");
		out.println("<table><tr><td width='210'></td><td> <img border=2 src='image/"+itemName.toString().trim()+"' width=800 height=600></td></tr></table>");
		out.println("</body>");
		out.println("</html>");

Advice, quickly learn JSP. Your sort of Java web developing is very old.

in html when you specify a name or source for anything, like say input fields, you can just write them without any quotes. but when that name or source is multi worded with space in between, you need quotes.

the example will clear it for you <input type=text name=NameField > here no quotes are required around NameField

but there will be in this one: <input type=text name="Name Field" > similarly it goes for your image src tag, because most probably the image you are picking up from your drive will have more then 1 word in its filename

ya.... I agree with peter_budo.....
new technology coming out day by day...
its easy for use.....but before use it learn basic with old....it not a problem....
its my thought......................

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.