How to get file size from clientside using javascript in IE?

前端 未结 5 933
走了就别回头了
走了就别回头了 2020-12-31 15:03

I used the following methode

HTML


JavaScript

5条回答
  •  甜味超标
    2020-12-31 15:32

    IE doesn't support File API

    source : https://github.com/blueimp/jQuery-File-Upload/issues/147

    have to use an ActiveX control to perform this action

    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");
    }
    

    source: http://www.sencha.com/forum/showthread.php?196859-File-Upload-Field-IE-Safari-Opera-fileInput-error.&s=b124834725ae363759158268d91ac32c

提交回复
热议问题