首页 > 技术文章 > 图片上传页面及时显示

YuTaiYin 2017-09-14 09:46 原文

$("#headIDCard").change(function(){

var objUrl = getObjectURL(this.files[0]) ;

if (objUrl) {

$("#imgheadIDCard").attr("src",objUrl) ;

}

}) ;

   

   

   

   

function getObjectURL(file) {

var url = null ;

if (window.createObjectURL!=undefined) {

url = window.createObjectURL(file) ;

} else if (window.URL!=undefined) {

url = window.URL.createObjectURL(file) ;

} else if (window.webkitURL!=undefined) {

url = window.webkitURL.createObjectURL(file) ;

}

return url ;

}

   

推荐阅读