<div class="ge_pic_icon_Infor"><img src="images/moren.jpg"/></div><div class="Infor_file"><input type="file" name="uploadPicture" id="file" value="" title="上传照片" οnchange="getPhoto(this)"/></div>
<script type="text/javascript">var imgurl = "";function getPhoto(node) {var imgURL = "";try{var file = null;if(node.files && node.files[0] ){file = node.files[0];}else if(node.files && node.files.item(0)) {file = node.files.item(0);}//Firefox 因安全性问题已无法直接通过input[file].value 获取完整的文件路径try{imgURL = file.getAsDataURL();}catch(e){imgRUL = window.URL.createObjectURL(file);}}catch(e){if (node.files && node.files[0]) {var reader = new FileReader();reader.onload = function (e) {imgURL = e.target.result;};reader.readAsDataURL(node.files[0]);}}creatImg(imgRUL);return imgURL;}function creatImg(imgRUL){var textHtml = "<img src='"+imgRUL+"'width='414px' height='600px'/>";$(".ge_pic_icon_Infor").html(textHtml);}</script>
input file 点击上传按钮 选择一张本地图片 显示到img里
/niyingxunzong/article/details/16989947
如果觉得《js/jq input file获取本地文件路径 将要上传图片显示到页面》对你有帮助,请点赞、收藏,并留下你的观点哦!