$('#upload').change(function(){
var f=this.files[0];
var _URL = window.URL || window.webkitURL;
var file, img;
if((file = f)){
img = new Image();
img.onload = function(){
var imgW = this.width;
var imgH = this.height;
if(imgW < 150 || imgH < 150){alert(imgW);}
else{alert('pass');}
};
img.src = _URL.createObjectURL(file);
}
});
I have an input file, it can check user's image too small, it works all browser expect Safari 5.1.7(windows version), Mac have higher version, works fine.
I have no idea where went wrong, anyone can find the problem?
The FileAPI isn't fully supported in Safari 5.1. You probably have use a multiparty form and upload the file because looks like the FileReader piece is missing in safari 5.1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.