-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
55 lines (44 loc) · 1.39 KB
/
index.php
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
<?php
include('lib/panda.php');
include('lib/config.inc.php');
include('lib/head.inc.php');
?>
<p>This is an example <strong>Panda</strong> client application, written in <strong>PHP</strong>.</p>
<form action="/player.php" id="new_video" method="POST">
<input type="hidden" name="panda_video_id"/>
<div class='progress progress-striped progress-success active'>
<span id="progress-bar" class='bar'></span>
</div>
<div class='btn-toolbar'>
<div id='browse-files' class='btn btn-primary btn-success'><span>Choose file</span></div>
<button id='cancel-button' type="button" class='btn btn-danger'>Cancel</button>
</div>
</form>
<script type="text/javascript">
$('#cancel-button').click(function(e){
upl.cancel(upl.getQueuedFiles()[0]);
e.preventDefault();
})
var upl = panda.uploader.init({
'buttonId': 'browse-files',
'progressBarId': 'progress-bar',
'authorizeUrl': "lib/authorize_upload.php",
'onProgress': function(file, percent) {
console.log("progress", percent, "%")
},
'onSuccess': function(file, data) {
$("#new_video")
.find("[name=panda_video_id]")
.val(data.id)
.end()
.submit();
},
'onCancel': function(file, data) {
upl.setProgress(0);
},
'onError': function(file, message) {
console.log("error", message)
}
});
</script>
<?php include('lib/foot.inc.php'); ?>