forked from blueimp/jQuery-File-Upload
-
Notifications
You must be signed in to change notification settings - Fork 11
/
basic.html
225 lines (204 loc) · 8.4 KB
/
basic.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin Basic Demo 1.2.4
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
-->
<html lang="en">
<head>
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<meta charset="utf-8">
<title>jQuery File Upload Demo - Basic version</title>
<meta name="description" content="File Upload widget with multiple file selection, drag&drop support and progress bar for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap styles -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<!-- Generic page styles -->
<link rel="stylesheet" href="css/style.css">
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link rel="stylesheet" href="css/jquery.fileupload.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="http://kaltura.github.io/jQuery-File-Upload/">Demo</a></li>
<li><a href="https://github.com/kaltura/jQuery-File-Upload#download">Download</a></li>
<li><a href="https://github.com/kaltura/jQuery-File-Upload">Source Code</a></li>
<li><a href="https://github.com/kaltura/jQuery-File-Upload/wiki">Documentation</a></li>
<li><a href="https://github.com/blueimp/jQuery-File-Upload#support">Support</a></li>
<li><a href="https://blueimp.net">© Sebastian Tschan</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="clearfix">
<div class="pull-left">
<h1>jQuery File Upload Demo</h1>
<h2 class="lead">Basic version</h2>
</div>
</div>
<br>
<br>
<div id="hostedAuthWidget"></div>
<div id="initSection">
KS:<input id="tb_KS" type="text" title="ks" placeholder="insert ks here or use the login above" style="width:400px"> <br/>
<input id="cb_chunk" type="checkbox">Use Chunk with size <input id="tb_chunkSize" type="text" value="500000"> bytes <br/>
<input id="cb_lbd" type=checkbox>Use lbd.kaltura.com
<input id="cb_testing" type=checkbox>Use www.kaltura.co.cc
<br/>
<input id="init" type="button" value="init" class="btn-large btn-block btn-primary ">
</div>
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button">
<i class="glyphicon glyphicon-plus"></i>
<span>Select files...</span>
<!-- The file input field used as target for the file upload widget -->
<input id="fileupload" type="file" name="fileData" multiple>
</span>
<br>
<br>
<!-- The global progress bar -->
<div id="progress" class="progress">
<div class="progress-bar progress-bar-success"></div>
</div>
<!-- The container for the uploaded files -->
<div id="files" class="files"></div>
<br>
<div class="panel panel-default">
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="js/vendor/jquery.ui.widget.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="js/jquery.fileupload.js"></script>
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="js/webtoolkit.md5.js"></script>
<script src="js/jquery.fileupload-kaltura.js"></script>
<script src="//cdnapisec.kaltura.com/p/243342/sp/24334200/embedIframeJs/uiconf_id/20540612/partner_id/243342"></script>
<script src="//cdnapisec.kaltura.com/html5/html5lib/v2.10/kWidget/kWidget.auth.js"></script>
<script>
/*jslint unparam: true */
/*global window, $ */
$(function () {
'use strict';
kWidget.auth.getWidget( "hostedAuthWidget", function( userObject ){
var ks = userObject["ks"];
// $('#fileupload').fileupload({disabled:false,ks:ks});
$("#tb_KS").val(ks);
});
$("#init").click(function()
{
$("#initSection").hide();
var ks = $("#tb_KS").val();
var useChunk = $("#cb_chunk").get(0).checked;
var chunkSize = $("#tb_chunkSize").val();
if (useChunk)
{
initUpload(ks,parseInt(chunkSize));
}
else
{
initUpload(ks);
}
})
function initUpload(ks,chunkSize)
{
var lbd = $("#cb_lbd").get(0).checked;
var testing = $("#cb_testing").get(0).checked;
$("#fileupload").show();
$('#fileupload').fileupload({
apiURL:'http://www.kaltura.com/api_v3/',
url: 'http://www.kaltura.com/api_v3/?service=uploadToken&action=upload&format=1',
ks: ks,
ignoreChunkHeader:true,
dataType: 'json',
autoUpload: true,
done: function (e, data) {
alert("done");
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .progress-bar').css(
'width',
progress + '%'
);
}
}).prop('disabled', !$.support.fileInput)
.parent().addClass($.support.fileInput ? undefined : 'disabled');
if (chunkSize)
{
$('#fileupload').fileupload({
maxChunkSize: chunkSize
});
}
if (lbd)
{
$('#fileupload').fileupload({
apiURL:'http://lbd.kaltura.com/api_v3/',
url: 'http://lbd.kaltura.com/api_v3/?service=uploadToken&action=upload&format=1'
});
}
if (testing)
{
$('#fileupload').fileupload({
apiURL:'http://www.kaltura.co.cc/api_v3/',
url: 'http://www.kaltura.co.cc/api_v3/?service=uploadToken&action=upload&format=1'
});
}
}
//
// // Change this to the location of your server-side upload handler:
// var url = window.location.hostname === 'blueimp.github.io' ?
// '//jquery-file-upload.appspot.com/' : 'server/php/';
// $('#fileupload').fileupload({
// url: url,
// dataType: 'json',
// done: function (e, data) {
// $.each(data.result.files, function (index, file) {
// $('<p/>').text(file.name).appendTo('#files');
// });
// },
// progressall: function (e, data) {
// var progress = parseInt(data.loaded / data.total * 100, 10);
// $('#progress .progress-bar').css(
// 'width',
// progress + '%'
// );
// }
// }).prop('disabled', !$.support.fileInput)
// .parent().addClass($.support.fileInput ? undefined : 'disabled');
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41071247-1', 'blueimp.github.io');
ga('send', 'pageview');
</script>
</body>
</html>