-
Notifications
You must be signed in to change notification settings - Fork 1
/
fileupload.php
executable file
·98 lines (81 loc) · 3.04 KB
/
fileupload.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
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Plupload - Custom example</title>
<!-- production -->
<script type="text/javascript" src="/plupload-2.0.0/js/plupload.full.min.js"></script>
<!-- debug
<script type="text/javascript" src="../js/moxie.js"></script>
<script type="text/javascript" src="../js/plupload.dev.js"></script>
-->
</head>
<br />
<div id="uploader">
<h2>File Upload:</h2>
<p>Current Queue:</p>
<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
<br />
<div id="container">
<script>
var verify;
if (verify === true) {document.write('<a id="pickfiles" href="javascript:;">[Add Files to Queue]</a> <a id="uploadfiles" href="javascript:;">[Upload Queue]</a>') //tried to make the buttons less confusing
}
</script>
</div>
</div>
<br />
<pre id="console"></pre>
<script type="text/javascript">
// Custom example logic
function reload()
{
}
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,html4',
browse_button : 'pickfiles', // you can pass in id...
container: document.getElementById('container'), // ... or DOM Element itself
url : '/upload.php',
flash_swf_url : '/plupload-2.0.0/js/Moxie.swf',
silverlight_xap_url : '/plupload-2.0.0/js/Moxie.xap',
chunk_size : '1mb',
max_file_size : '10gb',
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
document.getElementById('uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' + '<a id="cancel" href="javascript:deletefile(\'' + file.id + '\');">[Cancel]</a>' + '</div>';
});
},
UploadProgress: function(up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
Error: function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
uploader.init();
uploader.bind('UploadComplete', function(reload) {
window.location.replace(document.URL);
});
uploader.bind('QueueChanged', function(up, files) {
});
function deletefile(name)
{
//alert("start");
uploader.removeFile(name);
//uploader.refresh();
var div = document.getElementById(name);
div.parentNode.removeChild(div);
//alert("finished");
}
</script>
</body>
</html>