主要是利用img的fileSize属性
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>客户端控制上传图像大小示例 - 51windows</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<input type="file" id="file" name="file" />
<img src="" width=0 height=0 id="img" />
<input type="button" value="查看文件大小" onclick="getFileSize()" />
</body>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getFileSize() {
var img = document.getElementById("img");
var file = document.getElementById("file");
img.src = file.value;
alert(img.fileSize/1024);
}
//-->
</SCRIPT>
</html>