现在,这段代码在Firefox中运行良好,但是当我尝试在IE8上执行它时,我从浏览器中得到以下错误(选择文件后完全)。我完全不知道如何解决它。
IE8错误:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) Timestamp: Thu, 2 Oct 2014 06:53:20 UTC
Message: 'length' is null or not an object Line: 2 Char: 2815 Code: 0 URI: http://localhost:8090/JQueryStrutsFileUploadTest/js/jquery-1.11.1.min.js
HTML专栏:
<form action="/fileUploadAction.do" id="uploadform" method="POST">
<input id="fileupload" type="file" name="files[]" style="display: none;" multiple />
<input type="button" value="Upload" onclick="document.getElementById('fileupload').click();" />
</form>
<h5 style="text-align:center"><i style="color:#ccc"><small>Max File Size: 2 Mb - Display last 20 files</small></i></h5>
<table id="uploaded-files" class="table" border="1" cellspacing="1">
<tr>
<th>File Name</th>
<th>File Size</th>
<th>File Type</th>
<th>Cancel Action</th>
</tr>
</table>
<table>
<tr>
<td colspan="2"><input type="submit" id="btnSubmit" value="Upload All" /></td>
</tr>
</table>
JQuery Line:
<script src="jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var parent_files = []
$('#fileupload').change(function() {
var user_files = this.files;
$.each(user_files, function( index, file ) {
$("#uploaded-files").append(
$('<tr/>')
.append($('<td/>').text(file.name))
.append($('<td/>').text(file.size))
.append($('<td/>').text(file.type))
.append($('<td/>').html("<a href='#' onclick='javascript:removeFiles(\""+ file.name +"\")'> Cancel </a>"))
)//end $("#uploaded-files").append()
parent_files.push(file);
console.log(parent_files);
});
});
</script>
答案 0 :(得分:1)
IE8不支持多个文件:(