var a=document.querySelector('input[type=file]'); a.onchange = function (e) { //var reader = new FileReader();//reader.readAsDataURL(a.files[0]);//reader.onload = function (event) {//img.src = event.target.result;//}; var reader = new FileReader(); r