-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
67 lines (57 loc) · 1.77 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="webuploader.js"></script>
</head>
<body>
<div id="uploader" class="wu-example">
<!--用来存放文件信息-->
<div id="thelist" class="uploader-list"></div>
<form action="1.php" method="post" enctype="multipart/form-data">
<input type="file" name="name" value="">
<input type="file" name="name" value="">
<div class="btns">
<div id="picker"></div>
<button id="ctlBtn" class="btn btn-default" type="button">开始上传</button>
</div>
<input type="submit" value="提交">
</form>
<div id="list">
</div>
</div>
<script>
$(function () {
var list = $('#list');
var uploader = WebUploader.create({
// swf文件路径
swf: 'Uploader.swf',
// 文件接收服务端。
server: '1.php',
fileVal:'name',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: {
id: '#picker',
innerHTML: '选择',
multiple:true
},
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
resize: false
});
uploader.on( 'fileQueued', function( file ) {
list.append( '<div id="' + file.id + '" class="item">' +
'<h4 class="info">' + file.name + '</h4>' +
'<p class="state">等待上传...</p>' +
'</div>' );
});
$('#ctlBtn').on( 'click', function() {
console.log("上传...");
uploader.upload();
console.log("上传成功");
});
});
</script>
</body>
</html>