Dot*_*rce 0 jquery html5 file-upload css3
我使用jQuery上传图像文件,但每当我上传任何选定的图像.为此,我需要Priview在IE浏览器中显示Image.但Firefox和Chrome支持的下列功能集.
<Script>
function previewImages(input) {
$('#ImagePreview').html('');
var fileList = input.files;
var anyWindow = window.URL || window.webkitURL;
for (var i = 0; i < fileList.length; i++) {
var objectUrl = anyWindow.createObjectURL(fileList[i]);
$('#ImagePreview').append('<a href="#" class="remove"></a><img src="' + objectUrl + '" class="img-polaroid" style="height:70px;width:70px;">');
window.URL.revokeObjectURL(fileList[i]);
}
}
<h1>Upload Image</h1>
<div class="form_scpop" >
<form action="" method="get">
<input type ="file" onchange="previewImages(this);" multiple/>
<input name="" type="" id="image_alt" class="input_txt" />
<div id="ImagePreview" ></div>
<button class="btn btn-info" type="button" onclick="closeimgwindow()">Save</button>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
IE8和IE9 files不支持该属性<input type ="file" multiple>.只有符合HTML5标准的浏览器才支持它 更新到IE 10并尝试您的代码.
var fileList = input.files;
//fileList is undefined in IE 8 and IE 9
Run Code Online (Sandbox Code Playgroud)
更新
IE8/IE9没有在类型的输入元素上实现多个选项(没办法做到这一点,请参见此处).如果可能,请尝试删除多个选项并测试代码.否则,您将不得不通过AJAX为旧IE实现文件上传.更新到IE10浏览器更容易.
| 归档时间: |
|
| 查看次数: |
1143 次 |
| 最近记录: |