My code is working fine in Firefox and Internet Explorer 6 but Internet Explorer 7 is not showing images.
Here is the code,
<script type="text/javascript">
function ShowImage()
{
//document.getElementById('videoupload').valuedocument.getElementById('videoupload').value.replace( "file:///", "")
var img = document.createElement("IMG");
if(document.all)
img.src = document.getElemen开发者_运维技巧tById('videoupload').value;
else if(window.sidebar)
{
// solution for FF
img.src = document.getElementById('videoupload').files.item(0).getAsDataURL();
}
else
img.src = document.getElementById('videoupload').value;
document.getElementById('show').appendChild(img);
//alert(img.src);
}
</script>
<form name="frmlist" enctype="multipart/form-data" method="post">
Filename: <INPUT type="file" id="videoupload">
<INPUT type="button" id="btn_video" onClick="ShowImage();" value="Upload">
</form>
<div id="show"></div>
It is a security issue since IE7. It will only work from low security, e.g. people will need to add your site to trusted sites or load the page from harddisk
精彩评论