我正在开发html5网站,我也需要支持ie8。我在IE8上传照片时遇到问题,在IE9 +和其他浏览器中工作正常:
我的代码:
var fileInput = $('#uploadMedia');
var maxSize = imageMaxsize;
var isVideo = isVideos(fileInput.val());
var isImage = isImages(fileInput.val());
if(! isVideo && !isImage ){
alert("error");
$.fancybox.open('#uploaded_error');
}
if (isVideo)
var maxSize = videoMaxSize;
if(fileInput.get(0).files.length || fileInput.get(0).files.length ==null){
var fileSize = fileInput.get(0).files[0].size; // in bytes
// alert(fileSize);
if(fileSize>maxSize){
//alert("error2");
$.fancybox.open('#uploaded_error');
return false;
}
}
我在行fileInput.get(0).files.length
错误:
get(...).files.length' is null or not an object
对此有何建议?