开发者

javascript or jquery fileSize

I was looking all over the web how i can get the file size on the client side so i found a few examples the first example was

$(this)[0].files[0].fileSize

but unfortunately it does not working in ie

so i found this example

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");
}
开发者_运维问答

which is suppose to work in ie but i heard it has security problems and i don't know if it work in all browsers..

so , i need to know what i can use in javascript client side to get the file size.. e.g : file from input type file thank you for helping.


JavaScript cannot access any information about local files. This is done deliberately for security reasons.

ActiveXObject("Scripting.FileSystemObject"); is an IE-only construct and will not work across browsers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜