客户端使用HTML5检查文件大小? [英] Client Checking file size using HTML5?
本文介绍了客户端使用HTML5检查文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
$ b
if(typeof FileReader!==undefined){
var size = document.getElementById('myfile')。files [0] .size;
//检查文件大小
}
I'm trying to ride the HTML5 wave but I'm facing a small issue. Before HTML5 we were checking the file size with flash but now the trend is to avoid using flash in web apps. Is there any way to check the file size in the client side using HTML5?
解决方案
This works. Place it inside an event listener for when the input changes.
if (typeof FileReader !== "undefined") {
var size = document.getElementById('myfile').files[0].size;
// check file size
}
这篇关于客户端使用HTML5检查文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文