jQuery的fileupload不能在IE 8和9中工作 [英] jQuery fileupload not working in IE 8 and 9
本文介绍了jQuery的fileupload不能在IE 8和9中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此代码在FF和铬中工作。在IE 8或9中,我得到一个500错误,说非空属性为空。
This code works in FF and chrome. In IE 8 or 9 I get a 500 error saying a not null property is null.
这里是html
<div id="upload_button_div_general" class="fileupload-buttonbar" data-url="/Upload/SomeMethod">
<label class="fileinput-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" role="button">
<span class="ui-button-text">
<span>Add Documents...</span>
</span>
<input id="upload_button" type="file" name="postedFiles" multiple="" />
</label>
</div>
<div id="UploadMessage" data-bind="visible: showMessage">
<span>Documents</span>
<ul data-bind="foreach: upload()">
<li>
<a href="#" data-bind="click: $parent.openFile">
<span data-bind="text: $data.fileName"> </span>
</a>
</li>
</ul>
</div>
这里是javascript
Here is the javascript
function Upload(div, additionalParams, successFunc, failureFunc) {
$('#' + div).fileupload({
dataType: 'json',
url: rootPath + 'Upload/SomeMethod',
formData: additionalParams,
start: function (e, data) {
showLoading();
},
stop: function (e, data) {
hideLoading();
},
add: function (e, data) {
data.submit();
},
always: function (e, data) {
var result = data.result;
if (result.HasError) {
failureFunc(result.Error);
} else {
successFunc(result);
}
}
});
};
控制器方法是
The controller method is
public virtual JsonResult SomeMethod(IEnumerable<HttpPostedFileBase> postedFiles, int id)
推荐答案
我能够通过包括jquery.iframe-transport.js得到它的工作,然后我不得不删除我的敲除与从数据绑定的div来让它在IE8中工作因为它在IE9中工作。 (我有一个绑定上面我的发布的代码)感谢所有的建议。
I was able to get it working by including jquery.iframe-transport.js and then I had to remove my knockout "with" data-bind from the div to get it to work in IE8 because it worked in IE9. (I had a with binding above my posted code) Thanks for all the suggestions.
这篇关于jQuery的fileupload不能在IE 8和9中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文