身份证附件上传样例197

身份证附件上传样例

  

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<meta name="viewport"
content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>图片生成</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
list-style: none;
}

body {
font-size: 12px;
font-family: Arial, Verdana;
color: #fff;
font-weight: 100;
cursor: default;
background: #FFFFFF;
min-width: 320px;
}


.id_img_wp {
width: 94%;
margin: 0 auto;
min-height: 30px;
}

.img_wp {
width: 40%;
margin: 0 5% 0 5%;
float: left;
cursor: pointer;
}

.img_wp img {
width: 100%;
height: 100%;
}

.img_intro {
color: #383838;
text-align: center;
font-family: "微软雅黑";
padding: 10px 0 10px 0;
}

</style>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js">
</script>
</head>
<body>

<div class="id_img_wp">
<input type="file" accept="image/*" onchange="getzImg(this)" style="display:none" value="" id="img_z"/>
<input type="file" accept="image/*" onchange="getfImg(this)" value="" id="img_f" style="display:none"/>
<div class="img_wp" onclick="zhengmian()">
<img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1589461294667&di=0409372fc25fff2f14d18ccac627bb2b&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Ftranslate%2F20170630%2FGsVb-fyhskrp8296350.jpg"
id="zmz"/>
<p class="img_intro">身份证正面照</p>
</div>

<div class="img_wp" onclick="fanmian()">
<img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1589461294667&di=0409372fc25fff2f14d18ccac627bb2b&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Ftranslate%2F20170630%2FGsVb-fyhskrp8296350.jpg"
id="fmz"/>
<p class="img_intro">身份证反面照</p>
</div>
</div>

</form>

<script>
$(function () {
$('.img_wp img').height($('.img_wp img').width() * 0.6);
$(window).resize(function () {
$('.img_wp img').height($('.img_wp img').width() * 0.6);
})
})

//正面
function zhengmian() {
$('#img_z').click();
}

function getzImg(imgFile) {

var file = imgFile.files[0];

var reader = new FileReader();
reader.readAsDataURL(file);//将文件读取为Data URL小文件 这里的小文件通常是指图像与 html 等格式的文件
reader.onload = function (e) {
$("#zmz").attr("src", e.target.result);
}
}

//反面
function fanmian() {
$('#img_f').click();
}

function getfImg(imgFile) {

var file = imgFile.files[0];

var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function (e) {
$("#fmz").attr("src", e.target.result);
}
}

//申请
function checkForm() {
if ($('#img_z').val() == null || $('#img_z').val() == '') {
alert('请上传身份证正面照!');
return false;
}
if ($('#img_f').val() == null || $('#img_f').val() == '') {
alert('请上传身份证反面照!');
return false;
}
}
</script>
</body>
</html>

原文地址https://www.jianshu.com/p/3ae245229b78
原文地址:https://www.cnblogs.com/Ai-Hen-Jiao-zhi/p/12893233.html