var fileInput = document.querySelector('#file');
var preview = document.getElementById('preview');
fileInput.addEventListener('change', function(e) {
var var_error = 0;
$('.contest_upload_preview').show();
$('.contest_upload_error').hide();
preview.onload = function() {
var pic_width = this.naturalWidth;
var pic_height = this.naturalHeight;
var pic_size = $('#file')[0].files[0].size;
// alert("FS: "+pic_size);
if(pic_size > 15728640) {
//larger than 15MB (15728640).
var_error = 1;
var_upload_pic = 1;
preview.setAttribute('src', '');
} else {
//Dimension-check
if(pic_width < 720) {
var_error = 1;
var_upload_pic = 1;
preview.setAttribute('src', '');
}
if(pic_height < 720) {
var_error = 1;
var_upload_pic = 1;
preview.setAttribute('src', '');
}
}
window.URL.revokeObjectURL(this.src);
};
if(var_error == 0) {
console.log("geladen");
var url = URL.createObjectURL(e.target.files[0]);
preview.setAttribute('src', url);
var_upload_pic = 0;
}
}, false);
除了在 IE 11 中,此脚本工作正常。我收到此错误:DOM7001: Ungültiges Argument “url”。Fehler beim Sperren der folgenden Blob-URL
如果我用谷歌搜索“window.URL.revokeObjectURL IE11”它应该可以工作,知道为什么不可以吗?
谢谢