Find th File size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sruthini
    New Member
    • Aug 2007
    • 25

    Find th File size

    Hi,

    I am trying to checking the size of a file using javascript, I am using the following code
    [code=java]
    <html>
    <head>
    <script language="JavaS cript">
    function A()
    {
    var oas = new ActiveXObject(" Scripting.FileS ystemObject");
    var d = document.a.b.va lue;
    var e = oas.getFile(d);
    var f = e.size;
    var mb=f/(1024);
    alert(mb + "kilo bytes");
    }
    </script>
    </head>
    <body>
    <form name="a">
    <input type="file" name="b">
    <input type="button" name="c" value="SIZE" onClick="A();">
    </form>
    </body>
    </html>
    [/code]

    it is working well with html.

    But giving error with JSP.
    Error: Automation Server can't create object
    on the line
    var oas = new ActiveXObject(" Scripting.FileS ystemObject");

    plz give me solution. My server is tomcat4.1

    Thanks in Advance.
Working...