-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdemo.html
53 lines (50 loc) · 1.92 KB
/
demo.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
<!-- @format -->
<!DOCTYPE html>
<html lang="zh-hans">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Uploader</title>
<meta name="renderer" content="webkit" />
<link rel="dns-prefetch" href="//tiyee.com.cn" />
<link rel="dns-prefetch" href="//tiyee.cn" />
<link rel="dns-prefetch" href="//img.tiyee.cn" />
<link rel="shortcut icon" type="image/x-icon" href="https://img.tiyee.cn/favicon.ico?1" />
<link rel="mask-icon" sizes="any" href="https://img.tiyee.cn/favicon.svg" color="black" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
</head>
<body>
<div id="root">
<input type="file" id="upload" onchange="upload(this.files)" />
</div>
<script src="/dist/index.js?1221"></script>
<script>
document.getElementById('upload').onchange = function (e) {
console.log(uploader)
const file = e.target.files[0]
const ctx = {
maxConcurrency: 5,
totalSize: file.size,
chunkSize: 1024 * 1024,
uploadUrl: '/2/upload',
mergeUrl: '/2/merge',
touchUrl: '/2/init',
testChunks: false,
verfiyUrl: '',
headers: {Token: ''},
withCredentials: 'include',
}
const up = uploader(ctx, file)
up.on('progress', e => {
console.log('progess', e)
})
up.on('complete', e => {
console.log('complete', e)
alert(e.url)
})
up.run()
}
</script>
</body>
</html>