日期:2014-05-16  浏览次数:20396 次

js在火狐下获取上传文件大小
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
</HEAD>

<BODY>
<input type ="file" id='up'/>
<input type =button  value = "测试" onClick="test('up');"/>

<script>

function test(id){
var fup = document.getElementById(id);
var size = fup.files[0].fileSize;
   alert("文件大小:"+size);
}

</script>

</BODY>
</HTML>