-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.htm
More file actions
120 lines (85 loc) · 3.01 KB
/
default.htm
File metadata and controls
120 lines (85 loc) · 3.01 KB
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
<!DOCTYPE html>
<html>
<head>
<title>ASP/VBScript upload</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<script src="asplite/jquery.js"></script>
</head>
<body>
<main style="padding:50px">
<form id="uploadform">
<input class="form-control" type="file" name="files" id="files" multiple onchange="$('#uploadform').submit();return false;">
<div style="display:none;margin-top:20px" id="alert" class="alert alert-info" role="alert">
<div id="loading" class="spinner-border" style="float:right;width: 1.5rem; height: 1.5rem;" role="status"></div>
<div id="uploadFBS"></div>
<div id="uploadFB"></div>
</div>
</form>
</main>
<script>
var i=0
var j=0
var files
$("#uploadform").submit(function(e){
e.preventDefault()
$("#uploadFBS").html('<p><strong>Upload started (do not close this window!)</strong></p>')
$("#uploadFB").html('')
$("#loading").css("display","block");
$("#alert").css("display","block");
$("#uploadform").find("input[type=file]").each(function(index, field){
files=field.files
if (files.length>0) {jQueryUpload()}
})
});
function jQueryUpload() {
var file = files[i]
if (typeof(file) != "undefined") {
var fd = new FormData()
fd.append('file', file, file.name)
ajax(fd,file)
}
}
function ajax(fd,file) {
$.ajax({
type: "post",
method: "post",
url: "upload.asp",
dataType: "text",
contentType: false,
data: fd,
processData: false,
success: function (data) {
$("#uploadFB").append('<strong>' + file.name + '</strong> has been uploaded<br>')
i++;
if(i<files.length) {jQueryUpload()}
else {
//done
finish()
}
},
error: function (data) {
$("#uploadFB").append('<span style="color:Red"><strong>' + file.name + '</strong> (' + Math.round(file.size/1024/1024) + ' MB) was NOT uploaded</span><br>')
i++
j++
if(i<files.length) {jQueryUpload()}
else {
//done
finish()
}
}
})
}
function finish() {
$("#loading").css("display","none")
$("#uploadFBS").html('<strong>Upload completed</strong><br /><br>')
if(!j==0) {$("#uploadFB").prepend('<strong>' + j + ' files</strong> have NOT been uploaded (probably too big)<hr />')}
if(!(i-j)==0) {$("#uploadFB").prepend('<strong>' + (i-j) + ' files</strong> have been uploaded<hr />')}
i=0;j=0;
}
</script>
</body>
</html>