forked from zgcwkjOpenProject/PHP_FileUpload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (87 loc) · 3.52 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link type="text/css" rel="stylesheet" href="css/buttons.css" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<title>快传 - By zgcwkj</title>
</head>
<body>
<div class="container-center content" onclick="goClose()">
<div class="container-center operating" onclick="setCloseOk()">
<div class="load-container"></div>
<input type="file" name="file" id="upload_input" style="display: none">
<button class="button button-glow button-action" id="openFile">选择文件上传</button>
<div class="load">
<div class="load-bar" style="width: 0%;" progress="0" id="load_bar"></div>
</div>
</div>
<div class="container-center operating" onclick="setCloseOk()">
<div class="password-receive">
<input placeholder="输入秘钥,获取文件" id="key_input">
</div>
<button class="button button-glow button-royal" id="openKey">确定秘钥</button>
</div>
<div class="container-center operating bulletin">
<h3>公告</h3>
<div>文件会不定时清理,<br />请不要当做云盘使用!</div>
</div>
</div>
<div class="container-center">
<h1 style="margin-bottom: 50px">快速传递文件</h1>
<button class="button button-3d button-action btn-block" onclick="goOpenSend()">发送</button>
<button class="button button-3d button-royal btn-block" onclick="goOpenReceive()">接收</button>
</div>
<footer class="footer">
<p>Powered by <a href="http://blog.zgcwkj.cn/" target="_blank">zgcwkj</a></p>
</footer>
<script src="js/script.js"></script>
<script src="js/jquery.js"></script>
<script src="js/uploader.js"></script>
<script>
var openFile = document.getElementById('openFile');
var openKey = document.getElementById('openKey');
var upload_input = document.getElementById('upload_input');
var key_input = document.getElementById('key_input');
//发送文件
openFile.onclick = function () {
upload_input.click();
}
//选中文件后上传
upload_input.onchange = function () {
document.getElementsByClassName('load')[0].style.display = 'block';
var load_bar = document.getElementById('load_bar');
//上传文件
(new uploader($('#upload_input').get(0), {
url: 'upload.php',
error: function (err) {
alert(err.message);
},
success: function (mes) {
console.log(mes);
key_input.value = mes.key;
goOpenReceive();
},
progress: function (data) {
load_bar.style.width = data.percent + '%';
}
})).start();
}
//接收文件
openKey.onclick = function () {
$.post('upload.php', {
key: key_input.value,
}, function (data) {
if (data.status == 0) {
window.location.href = data.message.value;
} else {
key_input.value = '';
alert(data.message)
}
});
}
</script>
</body>
</html>