0
現在,這段代碼在Firefox中完全正常工作,但是當我嘗試在IE8上執行它時,我從瀏覽器中收到以下錯誤(,恰好在選擇文件後)。我對如何解決它完全無能爲力。無法使用JQuery上傳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的線路:
<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>
雅,認爲這是問題的根源。非常感謝:) – Thiagz 2014-10-02 07:20:30
我希望我能說更多,但是,就是這樣。 – brian 2014-10-02 07:22:41