Html:
1 <input type="file" id="MapUploadTd" onchange="getMapPictureSize(this.files[0])"/>
Js:
1 var mapPictureSize = []; 2 3 function getMapPictureSize(file) { 4 var reader = new FileReader; 5 reader.onload = function (evt) { 6 var image = new Image(); 7 image.onload = function () { 8 mapPictureSize[0] = this.width + ""; 9 mapPictureSize[1] = this.height + ""; 10 console.log(mapPictureSize); 11 }; 12 image.src = evt.target.result; 13 }; 14 reader.readAsDataURL(file); 15 }