forked from aralejs/upload
-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.html
73 lines (69 loc) · 2.36 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Uploader</title>
<script type="text/javascript" src="http://static.alipayobjects.com/seajs/1.3.0/sea.js"></script>
<style type="text/css">
.container {
margin: 0 auto;
width: 80%;
max-width: 680px;
padding: 60px 0;
}
</style>
<script type="text/javascript">
seajs.config({
alias: {'$': 'jquery/jquery/1.7.2/jquery'}
});
</script>
</head>
<body>
<div class="container">
<h1>Uploader DEMO</h1>
<p>This is a project by <a href="http://lepture.com">Hsiaoming Yang</a>.</p>
<h2>Select and Upload</h2>
<div class="cell">
<button id="uploader-1" href="#">Upload</button>
</div>
<h2>Select then upload</h2>
<div class="cell">
<p><button id="uploader-2" href="#">Select</button> <span id="upload-2-text"></span></p>
<p><button id="submit-2" href="#">Upload</button></p>
</div>
<h2>Only upload image</h2>
<div class="cell">
<button id="uploader-3" href="#">Upload</button>
</div>
</div>
<script type="text/javascript">
seajs.use(['$', '/src/upload'], function($, Uploader) {
new Uploader({
trigger: '#uploader-1',
action: '/'
}).success(function(data) {
alert(data);
});
var uploader = new Uploader({
trigger: '#uploader-2',
action: '/'
}).change(function(filename) {
$('#upload-2-text').text(filename);
}).success(function(data) {
alert(data);
});
$('#submit-2').click(function() {
uploader.submit();
return false;
});
new Uploader({
trigger: '#uploader-3',
accept: 'image/*',
action: '/'
}).success(function(data) {
alert(data);
});
});
</script>
</body>
</html>