Forum Moderators: open
I would like to show the image preview before they uploading.
I developed the javascript which is working well at IE but it is not working at the Firefox.
<script language="javascript">
var imgsr;
function display() {
imgsr=document.getElementById("file").value;
alert(imgsr);
}
</script>
<form enctype="multipart/form-data">
<input type="file" id="file" onchange="display();">
</form>
When it working at IE it showing me the full path given in the file box,but in Firefox it is only showing me the name of the file only.
Can any one help me to solve this issue.
Thanks
Ravi
In reality, this is really a security hole because it allows Javascript to read local files. A nefarious web site could use this in all sorts of ways. Until MS plugs it, it's a pretty cool feature, but to my knowledge no other browsers support it.
In my server-side script, this is one of the RARE instances where I use a browser ID to check for IE. If it's IE, I allow it to write the "preview" div to the upload page.