Forum Moderators: open

Message Too Old, No Replies

image preview

when uploading showing image preview

         

ravi

8:36 am on Jun 26, 2008 (gmt 0)

10+ Year Member



Hai,

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

rocknbil

6:31 pm on Jun 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah! I've done this! Problem is, it will only work in IE. My wife prefers FF, but has to switch to IE when uploading images because of it's convenience.

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.

ravi

12:27 pm on Jun 27, 2008 (gmt 0)

10+ Year Member



Thanks rocknbil,

I would like to do with the Firefox,if there is any option to do the image preview before uploading tell me.

Thanks
ravi