【发布时间】:2014-07-24 19:29:48
【问题描述】:
我只在 IE
$("input:file#upload-photo").fileupload({
enctype: "multipart/form-data",
url: $("input:file#upload-photo").attr("url"),
autoUpload: true,
send: function() {
spinner.spin(target);
},
done: function (e, data) {
spinner.spin(false);
var errors = data.result.Errors;
if (errors != null && errors.length > 0) {
for (var i = 0; i < errors.length; i++) {
var ul = $("<ul>").html("<li>" + errors[i] + "</li>");
$('#upload_photo_errors').html(ul);
}
} else {
$(".profile-photo").attr("src", data.result.Data.AvatarUrl);
}
},
error: function() {
spinner.spin(false);
}
});
“发送”处理程序被调用,“错误”处理程序也被调用。
我在 Fiddler 中收到了我的请求。它没有 Content-Type 和任何数据:
POST http://172.20.40.45/site/api/Users/Avatar HTTP/1.1
X-Requested-With: XMLHttpRequest
Accept: */*
Referer: http://172.20.40.45/site/Profile/Edit
Accept-Language: ru
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Host: 172.20.40.45
Content-Length: 0
DNT: 1
Connection: Keep-Alive
Pragma: no-cache
Cookie: ...
我已尝试检查http://blueimp.github.io/jQuery-File-Upload/ 上的上传过程。它在 IE9 中运行良好。为什么它在我的情况下不起作用?
【问题讨论】:
-
caniuse.com/fileapi 看看这个
-
@Dwza,这对我来说不是一个好的解决方案。我们在项目中支持 ie 9。
-
@shaunakde, jQuery File Upload 支持 ie 6.0+ github.com/blueimp/jQuery-File-Upload/wiki/Browser-support
标签: javascript jquery internet-explorer file-upload blueimp