-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (86 loc) · 3.34 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<title>Obtain Hash</title>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Obtain Hash from Zip</h1>
<small>Browse and select the desired zip file then hit "Obtain Hash" to begin processing</small>
</div>
<div class="row">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-paperclip"></span>
</div>
<input type="file" id="fileURL" class="btn btn-default btn-lg"/>
</div>
<button type="button" id="checkFile" class="btn btn-default btn-lg" disabled="true">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>Obtain Hash
</button>
<button type="button" id="clearContent" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>Clear
</button>
</div>
</div>
</div>
<script>
(function(){
var files,
file,
extension,
input = document.getElementById("fileURL"),
check = document.getElementById('checkFile');
clear = document.getElementById('clearContent');
input.addEventListener("change", function(e) {
// checks if input filed is filled
if(input.files.length > 0) {
check.disabled = false;
} else {
check.disabled = true;
}
// displays selected file
files = e.target.files;
output.innerHTML = "";
for (var i = 0, len = files.length; i < len; i++) {
file = files[i];
if (file.type.match('zip.*')) {
continue;
} else {
alert('Please select a .zip file')
input.value = '';
check.disabled = true;
output.removeChild(output.childNodes[0]);
}
extension = file.name.split(".").pop();
output.innerHTML += "<li class='type-" + extension + "'>" + file.name + "</li>";
}
}, false);
// clear input value
clear.addEventListener('click', function(e) {
input.value = '';
check.disabled = true;
output.removeChild(output.childNodes[0]);
}, false);
// post file to server
check.addEventListener('click', function(e) {
function postFile(file) {
xmlHttp=GetXmlHttpObject();
// url="index1.php";
// var params="columnSelector="+JSON.stringify(filterData);
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.onreadystatechange="";
xmlHttp.send(params);
}
}, false)
})();
</script>
</body>
</html>