You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.3 KiB

<%--
Created by IntelliJ IDEA.
User: ZZY_1
Date: 2023/12/24
Time: 11:24
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/bootstrap4/css/bootstrap.css">
<script type="text/javascript" src="/static/js/jquery-3.2.1.js"></script>
<script src="/static/My97DatePicker/My97DatePicker/WdatePicker.js"></script>
<script src="/static/bootstrap-treeview/js/bootstrap-treeview.js"></script>
<script src="/static/bootstrap4/js/bootstrap.js"></script>
<script type="javascript">
$(function(){
$("#uploadFile").click(function(){
alert("aaaa")
// 获取要上传的文件
var photoFile =$("#photo")[0].files[0]
if(photoFile==undefined){
alert("您还未选中文件")
return;
}
// 将文件装入FormData对象
var formData =new FormData();
formData.append("headPhoto",photoFile)
// ajax向后台发送文件
$.ajax({
type:"post",
data:formData,
url:"fileUpload.do",
processData:false,
contentType:false,
success:function(result){
// 接收后台响应的信息
console.log(result)
// 图片回显
}
})
})
})
</script>
</head>
<body>
<%-- <form action="login.do" method="post">
<input type="text" name="username">
<input type="text" name="password">
<input type="submit" value="登录">
</form>
<form action="toFile" method="get">
<input type="submit" value="跳转">
</form>--%>
<form action="addPlayer" method="get">
<p>账号<input type="text" name="name"></p>
<p>密码<input type="text" name="password"></p>
<p>昵称<input type="text" name="nickname"></p>
<p>头像:
<br/>
<input id="photo" type="file">
<a id="uploadFile" href="javascript:void(0)">立即上传</a>
<%--
onclick="upPic();return false;"
--%>
</p>
<p><input type="submit" value="注册"></p>
</form>
</body>
</html>