//判断照片大小
function getPhotoSize(obj){
var fileSize = 0;
var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
if (isIE && !obj.files) {
var filePath = obj.value;
var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
var file = fileSystem.GetFile (filePath);
fileSize = file.Size;
}else {
fileSize = obj.files[0].size;
}
fileSize=Math.ceil(fileSize/1024); //单位为KB
return fileSize;
}
<input name="file" size="30" type="file" onchange="getFileSize(this.value)" />