-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
51 lines (46 loc) · 1.67 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
<html>
<head>
<title>Test</title>
</head>
<body>
<form action="/upload" enctype="multipart/form-data" method="post" id="my_form">
<input type="text" name="title"><br>
<input type="file" name="upload" multiple="multiple"><br>
<input type="submit" value="Upload" id="submit_form">
</form>
<p id="progress"></p>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.iframe-post-form.js"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$('form').iframePostForm
({
post : function ()
{
// creating a long polling client
var client = new function() {
var _poll = function() {
$.get('/getProgress', function(response) {
$('#progress').html(response);
_poll();
});
}
$.get('/getProgress', function(response) {
$('#progress').html(response);
if ($('#progress').html().match(/^File\ saved/)) {
return;
} else {
_poll();
}
});
}
},
complete : function (response)
{
$('#progress').html(response);
}
});
})
</script>
</body>
</html>