user3467744
user3467744

Reputation: 21

Accessing file size information in IE and JavaScript

The code given below work fine with firefox but not not with ie....

<script language="javascript">
function findSize() {
    var fileInput =  document.getElementById("filename");

    f_size=fileInput.files[0].size; // Size returned in bytes.
    if(f_size>=2000000)
    {
        alert("File Should be less than or equel to 2MB");
        return false;
    }
    return true;   
}

give any solution

Upvotes: 0

Views: 42

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83788

Unfortunately, depending on the IE version you cannot use the latest JavaScript APIs and cannot access that information.

The solution is to stop using IE or parse that information on the server-side. I highly recommend the former.

Please see http://caniuse.com/ for the availability of JavaScript APIs for various browser versions.

Upvotes: 2

Related Questions