Obtain filesize without using FileSystemObject in JavaScript
<p>I am working on a project in ASP.NET, in which I want to get the filesize using JavaScript. Actually, I got the solution, and that is as like the following</p>

<pre><code>&lt;script language="javascript"&gt;
    var Fo =new ActiveXObject("Scripting.FileSystemObject");
    var fileName=new String();

    function Trim(input)
    {
        var lre = /^\s*/;
        var rre = /\s*$/;
        input = input.replace(lre, "");
        input = input.replace(rre, "");
        return input;
    }

    function getSize(filePath)
    {
        try
        {
            var thefile = Fo.getFile(filePath);
            var size = thefile.size;
            return size;
        }
        catch(err){}
    }

    function getType(filePath)
    {
        try
        {
            var thefile = Fo.getFile(filePath);
            var fileType = thefile.type;
            return fileType;
        }
        catch(err){}
    }

    function ShowErrorPnl(tblPnl)
    {
        document.getElementById(tblPnl).style.visibility='visible';
        document.getElementById(tblPnl).style.backgroundColor='Yellow';
        document.getElementById(tblPnl).style.borderColor='Silver';
    }

    function UploadFile_CheckType(fileUploadCtrl,messageCtrl,hFieldCtrl,tblPnl)
    {
        try
        {
            var file = document.getElementById(fileUploadCtrl);
            var fileName=file.value;
            document.getElementById(messageCtrl).innerText='';
            document.getElementById(tblPnl).style.visibility='hidden';
            document.getElementById(hFieldCtrl).value='';   //  File can be uploaded.
            //Checking for file browsed or not
            if((getSize(fileName)/1024)&gt;500)
            {
                document.getElementById(messageCtrl).innerText='  File size is exceeding 500K';

                document.getElementById(hFieldCtrl).value='0';  // File cannot upload.
                ShowErrorPnl(tblPnl);
                file.focus();
                return false;
            }
            if(getType(fileName)!='Microsoft Office Word 97 - 2003 Document' &amp;&amp;
               getType(fileName)!='Adobe Acrobat Document')
            {
                document.getElementById(messageCtrl).innerText=
                  (document.getElementById(messageCtrl).innerText=='' ?
                  '  Only Doc and pdf file can be upload!!!' :
                  document.getElementById(messageCtrl).innerText +
                    '\n'+'  Only Doc and pdf file can be upload!!!');
                ShowErrorPnl(tblPnl);
                document.getElementById(hFieldCtrl).value='0';  // File cannot upload.
                file.focus();
                return false;
            }
        }
        catch(err){}
    }
&lt;/script&gt;
</code></pre>

<p>It is working perfectly unless making some setting in Internet Explorer Properties.</p>

<p>In Internet Properties - > Select Security tab - > Local Internet - > Click on Custom Level button - > Initialize and script ActiveX controls not marked as safe for scripting - > Make it Enable</p>

<p>Save settings and execute program.</p>

<p>This is working, but I want to get filesize without
using <code>var Fo =new ActiveXObject("Scripting.FileSystemObject");</code></p>
