JQUERY验证上传文件大小
function checkImgType(this_){
 
   var filepath=$(this_).val();
   var extStart=filepath.lastIndexOf(".");
 
   var ext=filepath.substring(extStart,filepath.length).toUpperCase();
 
   if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"){
 
  alert("图片限于png,gif,jpg格式");
  $(this_).focus();
  if ( $.browser.msie) {  //判断浏览器
    this_.select();
             document.execCommand("delete");
  }else{
$(this_).val("");
  }
  return false;
   }
 
   var file_size = 0;          
                if ( $.browser.msie) {      
                   var img=new Image();
   	img.src=filepath;   
 
if(img.fileSize > 0){
 
if(img.fileSize>3*1024){   
alert("图片不大于3MB。");
$(this_).focus();
     this_.select();
                                  document.execCommand("delete");
 return false ;
}
 
}
 
                } else {
 
                    file_size = this_.files[0].size;   
 
                    console.log(file_size/1024/1024 + " MB");     
 
var size = file_size / 1024;  
alert(size);
if(size > 3){  
alert("上传的文件大小不能超过3M!");  
$(this_).focus();
$(this_).val("");
return false ;
}
}
       return true;
}
    "唯有高屋建瓴,方可水到渠成"
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号