check the file size using jquery
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1601455/check-file-input-size-with-jquery">Check file input size with jQuery</a>  </p>
</blockquote>



<p>i need to check the uploaded image size is less than  5mb</p>

<p>i using the following code</p>

<pre><code>$("#fileUpload").change(function () {

        $file = $("#fileUpload");
        var a = $file[0];

        var iSize = ($file[0].files[0].size / 1024);
        if (iSize / 1024 &gt; 1) {
            iSize = (Math.round((iSize / 1024) * 100) / 100)
            alert('file size is ' + iSize);
            if (iSize &gt; 5) {
                $('#FileImageSizeValidation').show();
            }

        }

    });
</code></pre>

<p>in that, i got the undefined error on $file[0].files[0]. it shows error in this line.
how to do this.</p>

<p>thanks 
pooja</p>
