-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
134 lines (116 loc) · 4.26 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Uploader</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/uploader.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<script type="text/javascript" src="js/plupload.js"></script>
<script type="text/javascript" src="js/plupload.gears.js"></script>
<script type="text/javascript" src="js/plupload.silverlight.js"></script>
<script type="text/javascript" src="js/plupload.flash.js"></script>
<script type="text/javascript" src="js/plupload.browserplus.js"></script>
<script type="text/javascript" src="js/plupload.html4.js"></script>
<script type="text/javascript" src="js/plupload.html5.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand">Uploader</a>
</div>
</div>
</div>
<header class="jumbotron subhead">
<div class="container">
<h1>Please upload your files here.</h1>
<p>Thank you.</p>
</div>
</header>
<div class="container">
<div class="row">
<hr>
<div class="span12">
<div id="filecontainer">
<div id="filelist">Error!</div>
<br />
<br />
<div id="progress" class="progress-striped active">
<div id="bar" style="width: 0%;"></div>
</div>
<a id="pickfiles" href="javascript:;" class="btn btn-large">Choose Files</a>
<a id="uploadfiles" href="javascript:;" class="btn btn-large btn-primary disabled">Upload Files</a>
</div>
</div>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function() {
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : 'pickfiles',
container : 'filecontainer',
max_file_size : '10mb',
url : 'upload.php',
flash_swf_url : '/plupload/js/plupload.flash.swf',
silverlight_xap_url : '/plupload/js/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
});
uploader.bind('Init', function(up, params) {
$('#filelist').html("<div></div>");
});
$('#uploadfiles').click(function(e) {
uploader.start();
e.preventDefault();
});
uploader.init();
uploader.bind('FilesAdded', function(up, files) {
$.each(files, function(i, file) {
$('#filelist').append(
'<div id="' + file.id + '">' +
file.name + ' (' + plupload.formatSize(file.size) + ') <b class="label label-info"></b>' +
'</div>');
});
$('#uploadfiles').removeClass('disabled');
$(".alert").alert('close');
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('BeforeUpload', function(up){
$('#progress').addClass('progress active progress-striped');
$('#progress').removeClass('progress-success');
$('#bar').addClass('bar');
});
uploader.bind('UploadProgress', function(up, file) {
$('#' + file.id + " b").html(file.percent + "%");
$('#bar').css('width', uploader.total.percent + "%");
});
uploader.bind('UploadComplete', function(up){
$('#progress').removeClass('active progress-striped');
$('#progress').addClass('progress-success');
$('#filecontainer').append('<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><strong>Thanks!</strong> Your files were uploaded successfully.</div>');
});
uploader.bind('Error', function(up, err) {
$('#filelist').append('<div>Error: ' + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
' <span class="badge badge-important">!</span></div>'
);
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('FileUploaded', function(up, file) {
$('#' + file.id + " b").html("100%");
$('#' + file.id + " b").removeClass('label-info');
$('#' + file.id + " b").addClass('label-success');
});
});
</script>
</body>
</html>