0
<script>
function GetFileSize() {
    var fi = document.getElementById('file'); // GET THE FILE INPUT.

    // VALIDATE OR CHECK IF ANY FILE IS SELECTED.
    if (fi.files.length > 0) {
        // RUN A LOOP TO CHECK EACH SELECTED FILE.
        for (var i = 0; i <= fi.files.length - 1; i++) {

            var fsize = fi.files.item(i).size;      // THE SIZE OF THE FILE.
            document.getElementById('fp').innerHTML =
                document.getElementById('fp').innerHTML + '<br /> ' +
                    '<b>' + Math.round((fsize / 1024)) + '</b> KB';
        }
    }
}

Getting exception "Unable to get property 'length' of undefined or null reference" in fi.files.length

0

1 Answer 1

1

You can't.

IE 5 predates any native browser features for interacting with local files.

Note also that IE 5 hasn't been supported on Windows since Windows NT which hasn't had a security update in 18 years.

Do not use IE 5

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.