-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.html
37 lines (35 loc) · 1.3 KB
/
example.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
<html>
<head>
<script type="text/javascript" src="lib/js-secure-uploader.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oMessageBox = document.getElementById( 'message' );
var oFileInput = document.getElementById( 'file_path' );
var oUploader = new SecureUploader( oFileInput, {
'url' : 'example.php',
'worker_path' : 'lib/js-secure-uploader-worker.js',
'chunk_size' : 1048576, // 1MB.
'start_on_change' : true
} );
var nProgressInterval = setInterval( function()
{
var nProgress = oUploader.getProgressPercentage();
oMessageBox.innerHTML = Math.round( nProgress * 100 ) + '%';
// When we finish, we don't need to update any more.
if ( 1 == nProgress )
{
clearInterval( nProgressInterval );
}
}, 200 );
}
</script>
</head>
<body>
<p>
<input id="file_path" type="file" />
</p>
<p id="message">
</p>
</body>
</html>