Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Internet Explorer 7中,不显示预览图像_Php_Javascript - Fatal编程技术网

Php 在Internet Explorer 7中,不显示预览图像

Php 在Internet Explorer 7中,不显示预览图像,php,javascript,Php,Javascript,我的代码在Firefox和InternetExplorer6中运行良好,但InternetExplorer7没有显示图像 这是密码 <script type="text/javascript"> function ShowImage() { //document.getElementById('videoupload').valuedocument.getElementById('videoupload').value.replace( "file:/

我的代码在Firefox和InternetExplorer6中运行良好,但InternetExplorer7没有显示图像

这是密码

<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.getElementById('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>

函数ShowImage()
{
//document.getElementById('videoupload').valuedocument.getElementById('videoupload').value.replace(“文件:///”,“”)
var img=document.createElement(“img”);
如果(全部文件)
img.src=document.getElementById('videoupload')。值;
else if(窗口侧栏)
{
//FF的解决方案
img.src=document.getElementById('videoupload').files.item(0.getAsDataURL();
}
其他的
img.src=document.getElementById('videoupload')。值;
document.getElementById('show').appendChild(img);
//警报(img.src);
}
文件名:

自从IE7以来,这是一个安全问题。
它只能在安全性较低的情况下工作,例如,人们需要将您的站点添加到受信任的站点或从硬盘加载页面

,这在所有现代浏览器中都是不可能的,因为DOM不能直接访问文件系统。是的,但是Fx已经做了一个很好的解决方案,在这里您可以获得图像文件的B64编码内容