![](https://img.kancloud.cn/f4/7d/f47ddbe77373d042fefef268d23cdb4c_361x116.png)
```
<script src="https://www.jq22.com/jquery/jquery-3.3.1.js"></script>
<style type="text/css">
input[type|="file"]{
display:none;
}
.filebutton {
background-color: #d62c1a;
border-color: #cd2a19;
border-radius: 3px;
border: none;
color: white;
padding: 6px 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
<div class="upload">
<input id="c-specimages0" class="form-control" name="aa1[specimages]" type="text" >
<input type="file" id="plupload-specimages0" class="imgfile" text_id="c-specimages0" >
<button class="filebutton" p_id="plupload-specimages0">上传</button>
</div>
</body>
<script type="text/javascript">
$(".upload").on('change',".imgfile", function(){
var text_id= $(this).attr("text_id");
var fileObj1 = document.getElementById($(this).attr("id")).files[0]; // js 获取文件对象
var formFile = new FormData();
formFile.append("file", fileObj1);//加入文件对象
$.ajax({
url:'http://120.27.192.57:8084/FzSDZrWGeX.php/ajax/upload',
type:'post',
data: formFile,
processData : false,// 告诉jQuery不要去处理发送的数据,用于对data参数进行序列化处理 这里必须false
contentType : false, // 告诉jQuery不要去设置Content-Type请求头
success:function(response){
var fullurl=res.data.fullurl;
$(".form-group").find("#"+text_id).val(fullurl);
}
})
})
//change _id
$(".upload").on('click',".filebutton",function(){
var p_id= $(this).attr("p_id");
$("#"+p_id).click();
})
</script>
</html>
```