Closed
Bug 437597
Opened 17 years ago
Closed 17 years ago
Image file located on Harddrive of PC not displaying by <img src tag
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: rohanmane123, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
I am developing web application, in which it requires that the user selects image file from one of the drive like c:, D:, etc. And i wanted to show the selected image immediately in Browser in one corner. But this doesn't working using <img src> HTML tag. But this works fine in Internet Explorer. And i also tried to changed image path from \ to / ie Ex: C:\img.gif to C:/img.gif but this also doesn't work. If u have any solution to this please tell me.
Reproducible: Always
Steps to Reproduce:
1.Write one html page. Containing <img src tag
2.Write src="" actual path name with / Ex: C:/Pictures/img.jpg
3.Save and view it Mozilla browser
Actual Results:
The image is not displaying.
Expected Results:
Image should be displayed.
Comment 1•17 years ago
|
||
pkease look in the error console why this doesn't work and please search before you write a bug report.
BTW: c:/blah/foo.jpg is also not a correct URL.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
The image is not displaying in the jsp page on Tomcat based web application.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Version: unspecified → 2.0 Branch
Comment 3•17 years ago
|
||
No, you have written "Write src="" actual path name with / Ex: C:/Pictures/img.jpg" and you now are talking about tomcat but where are your examples and better steps to reproduce ?
For example:
1) access local tomcat server with http://127.0.0.1/test
2) in the loaded document an image with src=http://localhost/image.jpg doesn't load
Comment 4•17 years ago
|
||
you mean
1: access server with http://example.com/test
2) image src to file:///c:/image.jpg doesn't load
yes that's expected and you can read the reason in Firefox error console
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago → 17 years ago
Resolution: --- → INVALID
I mean i have created web application, it has Tomcat as Web application Server.
And i have jsp page in which i have a File Browse Component through which i want to Load image and view it on Page when the image is selected.The image location is from any Drive of PC like C:, D: etc. The image is not displaying. Even i have changed image path from C:\image.jpg to C:/image.jpg . This does work when i save the file as HTML file. And the HTML page is kept outside TomCat folder.
The HTML code is as follows. Put this HTML code file in Tomcat/Webapps and in any application and run. The image is not viewing.
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script language="javascript">
function updateImageSource(obj)
{
var imgsrc=obj.value;
var Length=imgsrc.length;
var temp='file:///';
for(i=0;i<Length;i++)
{
if(imgsrc[i]=='\\')
temp=temp+imgsrc[i].replace('\\','/');
else
temp=temp+imgsrc[i];
}
document.forms[0].imgContainer.src=temp;
}
</script>
<BODY>
<form name="frm">
<input type="file" name="loadImage" onChange="javascript:updateImageSource(this);"/>
<img src="" name="imgContainer" height=200 width=200 />
</form>
</BODY>
</HTML>
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 6•17 years ago
|
||
exactly what I told you in comment #1.
Look in the Firefox error console (Tools/Error Console) why this doesn't work (security restrictions).
You can load local files if the document itself is also loaded with file:// but in your case (tomcat web server) it's loaded with http://
Please do not open this bug again and please search before you file a bug, there are already a few bugs reported about this problem which is itself by design.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago → 17 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•