ThinkPHP5 通过ajax插入图片并实时显示(完整代码)(thinkphp 5.1.38getshell)硬核推荐

随心笔谈12个月前发布 admin
100 0


<html>
<head>
<meta charset=”UTF-8″>
<title>文件上传</title>
<style type=”text/css”>
#front {
width: 120px;
height: 120px;
background-color: #8A6DE9;
}
#frontage {
width: 120px;
height: 120px;
background-color: #8A6DE9;
}
#banking {
width: 120px;
height: 120px;
background-color: #8A6DE9;
}
#house {
width: 120px;
height: 120px;
background-color: #8A6DE9;
}
</style>
<script src=”http://libs.baidu.com/jquery/1.9.0/jquery.js”></script>
</head>
<body>
<form id=”uploadForm”>
<!– 1 –>
<p>身份证正面:<input type=”file” name=”drawing” id=”drawing” onchange=”identity(this)” autocomplete=”off” /></p>
<input type=”text” name=”” id=”fronts” value=”” />
<div id=”front”></div>
<!– 1 –>
<!– 2 –>
<p>身份证反面:<input type=”file” name=”reverse” id=”reverse” onchange=”card(this)” autocomplete=”off” /></p>
<input type=”text” name=”” id=”frontages” value=”” />
<div id=”frontage”></div>
<!– 2 –>
<!– 3 –>
<p>银行卡正面: <input type=”file” name=”transaction” id=”transaction” onchange=”obverse(this)” autocomplete=”off” /></p>
<input type=”text” name=”” id=”bankings” value=”” />
<div id=”banking”></div>
<!– 3 –>
<!– 4 –>
<p>银行卡反面: <input type=”file” name=”redlining” id=”redlining” onchange=”versa(this)” autocomplete=”off” /></p>
<input type=”text” name=”” id=”houses” value=”” />
<div id=”house”></div>
<!– 4 –>
</form>
</body>
</html>
<!– 身份证正面 –>
<script type=”text/javascript”>
function identity() {
var formData=new FormData();
formData.append(“drawing”, $(‘#drawing’)[0].files[0]);
// console.log(formData);
$.ajax({
url: “http://tp5-shopxo.likeball.top/index.php?s=/api/Mi/measurement”,
type: ‘POST’,
data: formData,
dataType: ‘JSON’,
cache: false,
processData: false,
contentType: false,
success: function(data) {
console.log(data);
if (data[‘whether’]==true) {
var result=”;
var result1=”;
result +='<img src=”https://www.jb51.net/article/’ + ‘http://tp5-shopxo.likeball.top/’ + data[‘site’] + ‘” width=”100″>’;
result1 +=’http://tp5-shopxo.likeball.top/’ + data[‘site’];
$(‘#front’).html(result);
$(‘#fronts’).val(result1);
}
},
error: function(data) {
console.log(“错误”);
}
});
}
</script>
<!– 身份证反面 –>
<script type=”text/javascript”>
function card() {
var formData=new FormData();
formData.append(“reverse”, $(‘#reverse’)[0].files[0]);
// console.log(formData);
$.ajax({
url: “http://tp5-shopxo.likeball.top/index.php?s=/api/Mi/measurement”,
type: ‘POST’,
data: formData,
dataType: ‘JSON’,
cache: false,
processData: false,
contentType: false,
success: function(data) {
console.log(data);
if (data[‘whether’]==true) {
var result=”;
var result1=”;
result +='<img src=”https://www.jb51.net/article/’ + ‘http://tp5-shopxo.likeball.top/’ + data[‘site’] + ‘” width=”100″>’;
result1 +=’http://tp5-shopxo.likeball.top/’ + data[‘site’];
$(‘#frontage’).html(result);
$(‘#frontages’).val(result1);
}
},
error: function(data) {
console.log(“错误”);
}
});
}
</script>
<!– 银行卡正面 –>
<script type=”text/javascript”>
function obverse() {
var formData=new FormData();
formData.append(“transaction”, $(‘#transaction’)[0].files[0]);
// console.log(formData);
$.ajax({
url: “http://tp5-shopxo.likeball.top/index.php?s=/api/Mi/measurement”,
type: ‘POST’,
data: formData,
dataType: ‘JSON’,
cache: false,
processData: false,
contentType: false,
success: function(data) {
console.log(data);
if (data[‘whether’]==true) {
var result=”;
var result1=”;
result +='<img src=”https://www.jb51.net/article/’ + ‘http://tp5-shopxo.likeball.top/’ + data[‘site’] + ‘” width=”100″>’;
result1 +=’http://tp5-shopxo.likeball.top/’ + data[‘site’];
$(‘#banking’).html(result);
$(‘#bankings’).val(result1);
}
},
error: function(data) {
console.log(“错误”);
}
});
}
</script>
<!– 银行卡反面 –>
<script type=”text/javascript”>
function versa() {
var formData=new FormData();
formData.append(“redlining”, $(‘#redlining’)[0].files[0]);
// console.log(formData);
$.ajax({
url: “http://tp5-shopxo.likeball.top/index.php?s=/api/Mi/measurement”,
type: ‘POST’,
data: formData,
dataType: ‘JSON’,
cache: false,
processData: false,
contentType: false,
success: function(data) {
console.log(data);
if (data[‘whether’]==true) {
var result=”;
var result1=”;
result +='<img src=”https://www.jb51.net/article/’ + ‘http://tp5-shopxo.likeball.top/’ + data[‘site’] + ‘” width=”100″>’;
result1 +=’http://tp5-shopxo.likeball.top/’ + data[‘site’];
$(‘#house’).html(result);
$(‘#houses’).val(result1);
}
},
error: function(data) {
console.log(“错误”);
}
});
}
</script>

© 版权声明

相关文章