js 实现图片上传
2021-01-14 07:13
标签:select java hang func res put query lis var js 实现图片上传 标签:select java hang func res put query lis var 原文地址:https://www.cnblogs.com/fanqiuzhuji/p/13447236.html
var input1 = document.querySelector(‘#upload‘);//获取input
input1.addEventListener(‘change‘,upload)function upload(){
var oFReader = new FileReader();
oFReader.readAsDataURL(this.files[0])
oFReader.onload = function (event) {
tapDatas.file = event.target.result;
imgs.src = event.target.result;
console.log(tapDatas, ‘file文件‘);
}
}