Hi All,I am using ASP.NET to build a system.I want to implement a function, that the app can get the file's size before user uploads it through the file upload control. I know that due to the security policy, JavaScript will be blocked. But I found this URL:http://www.uploadify.com/demo/And it worked well in my Firefox, here is an official sample which applying UPLOADIFY in ASP.NET, but I actually I just would like to know the file's size, no need complexity.
 
If anyone can give me some suggestion, I will be really grateful.At the moment, I want to ascertain that is the function (getting size of file) done by JQurey or Flash.Thanks.
 

解决方案 »

  1.   

    yeah. that it is .
      

  2.   

    I have to change the requirement, if the function works fine in IE, then it is acceptable.So, I find this piece of code:<head>
    <script>
    function getSize()
    {
    var myFSO = new ActiveXObject("Scripting.FileSystemObject");
    var filepath = document.upload.file.value;
    var thefile = myFSO.getFile(filepath);
    var size = thefile.size;
    alert(size + " bytes");
    }
    </script>
    </head>
    <body>
    <form name="upload">
    <input type="file" name="file">
    <input type="button" value="Size?" onClick="getSize();">
    </form>
    </body>
    </html>But I got an error 'Automation对象不能创建'.I installed scrrun.dll and registered it on both server and client computer.Still got the same error. Anyone can help me? Thanks a lot.
      

  3.   


    due to the security policy!
      

  4.   

    I already set the security level to 'low', and in 'Security Settings' panel, and enabled 'Run ActiveX controls and plug-ins'. So, I don't think it is security problem.
      

  5.   

    If you want to use FSO, you'd first register it. Now, take the steps down.
    1. find scrrun.dll under the system dir, if successful, you can jump to step 3, or else, continue step 2.
    2. find scrrun.dl_ under i386 dir in the windows installment disk, decompress it, you will find the dll file scrrun.dll, then copy it to c:window\system32
    3. run statement "regsvr32 scrrun.dll"And if you want to shutdown FSO, just run "regsvr32 /u scrrun.dll".
      

  6.   

    Your script works well on my computer while I didn't reset anything.