I am trying to checking the size of a file using javascript, I am using the following code
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <script language="JavaScript">
- function A()
- {
- var oas = new ActiveXObject("Scripting.FileSystemObject");
- var d = document.a.b.value;
- 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>
But giving error with JSP.
Error: Automation Server can't create object
on the line
var oas = new ActiveXObject("Scripting.FileSystemObject");
plz give me solution. My server is tomcat4.1
Thanks in Advance.