js 計算文件的大小

 var isIE = /msie/i.test(navigator.userAgent) && !window.opera; 

     function fileChange(target) { 

         var fileSize = 0; 

         if (isIE && !target.files) { 

             var filePath = target.value; 

             var fileSystem = new ActiveXObject("Scripting.FileSystemObject");    

             var file = fileSystem.GetFile (filePath); 

             fileSize = file.Size; 

         else 

             fileSize = target.files[0].size; 

         }

     }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章