这是客户端代码,与Tomcat没有任何关系。把你的浏览器安全性降低即可

解决方案 »

  1.   

    把ie安全性降至最低。起用所有ActiveX,问题依然如故!
      

  2.   

    你调用错了,改成这样
    <html>
    <head>
    <script language=javascript>
    function getfile(){    
     var fso,f,s;
         fso = new ActiveXObject("Scripting.FileSystemObject");
         f = fso.GetFile(document.formname.file.value);     
         s = f.Name + " on Drive " + f.Drive + "<br>";     
         s += "文件建立的日期: " + f.DateCreated + "<br>";     
         s += "最后打开的时间: " + f.DateLastAccessed + "<br>";     
         s += "最后修改的时间: " + f.DateLastModified + "<br>";     
         s += "文件大小: "+f.size +" bytes" + "<br>";      
         s += "文件属性: "+f.attributes +"<br>";
          document.write(s);}   
    </script>
    </head>
    <body>
    <form name=formname action=filesize.htm  enctype="multipart/form-data" method="post" >
    <input name=file type=file>
    <input type="button" name="fileupb" value="送出" onclick="getfile()">
    </form>
    </body>
    </html>
      

  3.   

    to 大花猫 此代码放在tomcat服务器上依然报错!
      

  4.   

    s += "文件大小: "+f.size +" bytes" + "<br>";---------------->s += "文件大小: "+f.fileSize +" bytes" + "<br>"; 试试看
      

  5.   

    to 楼主
    ----
    我试过,完全可以的。你需要把internet选项中的“安全”页的activeX控件启用
      

  6.   

    <img src="http://community.csdn.net/images/CSDN_logo.GIF" id=aa>
    <input type=button onclick="alert(document.all.aa.fileSize)" value="ss">
    <input type=file onchange="document.all.aa.src=this.value">仅仅限于图片