html代码 <img id="newImage" alt="100x100" src="__PUBLIC__/img/1.jpg" class="img-circle" width="100px" height="100px" > <input id="image" type='file' name='myFile' size='15' onchange="showPicture(this)"/> js代码 function showPicture(imgFile){ // alert(window.URL.createObjectURL(imgFile.files[0])); /*获取上传文件的路径*/ document.getElementById("newImage").src = window.URL.createObjectURL(imgFile.files[0]); }