Question

I’m working on html5 website and I need to support ie8 also. I have problem with uploading photo in IE8 which works fine in IE9+ and other browsers:

My code:

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;
            }
    }

And I'm getting error in line fileInput.get(0).files.length

Error:

get(...).files.length' is null or not an object

Any suggestions on this?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top