我使用this plugin(只是基本版本),並利用所有整潔的功能進行更新以使用我自己的UI(使用Knockout.js和Twitter Bootstrap) 。下面是一些代碼片段爲背景:JQuery文件上傳插件,Internet Explorer和IFrame傳輸
// The file is sent to an ASP.NET MVC Web Api service to do all the business logic/DB stuff
uploadUrl = http://web.api.url/?apikey=key
$("#fileUpload" + "@index").fileupload({
headers: {
'Authorization': "@Html.AccessToken()",
'Accept': $.support.ajax ? "application/json" : "text/plain"
},
url: uploadUrl,
add: function (e, data) {
$.each(data.files, function (index, file) {
// add to KO viewmodel
});
data.submit();
},
fail: function (e, data) {
var error = data.errorThrown;
var text = data.textStatus;
},
done: function (e, data) {
// do some more viewmodel operations
},
progress: function (e, data) {
var progressPercentage = parseInt(data.loaded/data.total * 100, 10);
// update viewmodel
}
});
的#fileUpload<Index>
元素是文件輸入
而這在Chrome,FF和Safari但(驚喜驚喜)的偉大工程,沒有在IE中。當我試圖從我的文件輸入中選擇一個文件時,我收到了一個非常奇怪的迴應 - 瀏覽器打開一個下載對話框?
Do you want to open or save ?apikey=key (61 bytes) from webapiserver?
我嘗試使用IE瀏覽器的腳本調試器與我的文件上傳事件監聽器內斷點,它甚至從來沒有使得它的內部。我在我的研究中看到過各種帖子和文章,指出應用程序/ json的接受類型會搞砸IE,所以我在我的代碼中有一個條件來嘗試處理它。
有什麼我失蹤?
你有沒有得到解決這個的實現? –