C#结合HTML实现图片上传
效果预览
HTML
<table>
<tr>
<td rowspan="5" style="background:#ffffff">
<div style="height:140px;width:140px;border-radius:50px;text-align:center;margin:0 auto;">
<img id="Image" style="width:140px;height:140px;border-radius:50%;">
@*不让页面显示文件上传按钮,而是通过点击图片进行文件上传*@
<input id="uploadImage" name="file" accept=".png,.jpg,.jpeg" type="file" style="display: none">
<input id="ImageVal" style="display:none" />
</div>
</td>
</tr>
</table>
JS
$(document).ready(function () {
//图片上传控件初始化
uploadImg.initUploadImg();
})
//头像上传相关
var uploadImg = {
initUploadImg