在客户端上访问IE8中文件输入的文件数据? [英] Accessing File Data of file input in IE8 on the client?

查看:110
本文介绍了在客户端上访问IE8中文件输入的文件数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取文件输入中选择的实际文件数据?

Is it possible to get at the actual file data that is selected in a file input?

我正在尝试执行以下代码,而this.files不包含我期望的文件数据(确实存在于Chrome中)。

I'm trying to execute the following code and this.files does not contain the file data I was expecting (which does get there in Chrome).

document.getElementById('txtFileInput').onchange = function (event) {
                    //var files = event.target.files;
                    var files = this.files;
                    me.model.set('fileArray', files);
                };


<div class="fileInputContainer" style="display:none">
    <label for="txtFileInput">Edit file: </label>
    <input type="file" id="txtFileInput" class="txtFileInput"/>
</div>

我是否缺少IE或者不可能的东西?

Is there something I'm missing for IE or is it not possible?

推荐答案

IE 目前不允许操纵< input type =file> ;由于安全原因,来自JavaScript的元素。设置文件名或调用单击事件以显示浏览器对话框将导致表单提交访问被拒绝错误。 (IE很清楚记住调用了哪些方法)

IE currently doesn't allow manipulation of the <input type="file"> element from JavaScript due to security reasons. Setting the filename or invoking a click event to show the browser dialog will result in an "Access is denied" error on the form submit. (IE is clever about remembering what methods have been invoked)

请看这个类似的问题: http://www.webdeveloper.com/forum/showthread.php?t=181272

Please see this similar issue: http://www.webdeveloper.com/forum/showthread.php?t=181272

这篇关于在客户端上访问IE8中文件输入的文件数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆