epfs / index.html
ebrahim pishvaz
epfs1.1
4506508
Raw
History Blame Contribute Delete
3.17 kB
<!doctype html>
<!-- locate in templates folder -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="epfsbot file share">
<link rel="stylesheet" href="{{url_for('static', filename='file/bootstrap.min.css')}}">
<title>epfs file share</title>
<style>
tr {
white-space: nowrap;
}
</style>
</head>
<body>
<!-- <div class="container-fluid">-->
<table class="table table-striped table-hover">
<tbody>
<tr>
<form action = "/uploader" method = "POST" enctype = "multipart/form-data" >
<td>
<input class="form-control" type="file" name="file" id="file" multiple />
</td>
<td>
<input class="btn btn-success" type = "button" onclick="ax();" value="Upload File" />
</td>
</form>
</tr>
<tr>
<td colspan=3>
{% for i in varlist %}
<input id="ch1" class="form-check-input" type='checkbox' onchange='viewItem(".{{ i }}",this.checked);' checked>
<label class="form-check-label" for="ch1">{{ i }}</label>
{% endfor %}
</td>
</tr>
<tr>
<td colspan=3 >
<div id="pbar0" name="pbar0" class="progress" style="display:none;">
<div id="pbar" name="pbar" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">0%</div>
</div>
</td>
</tr>
{% for a in all_list %}
{% set ploop = loop %}
{% for b in a %}
<tr class="{{ varlist[ploop.index - 1] }}" >
<td colspan=3 >
<img src="/static/file/{{ varlist[ploop.index - 1] }}.png" width=32px height=32px class="mx-2" />
{% if path %}
<a href="{{ request.args['website'] }}/{{ path }}/{{ b }}" >
{% else %}
<a href="{{ request.args['website'] }}/{{ b }}" >
{% endif %}
{{ b }}
</a>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
<script src="{{url_for('static', filename='file/bootstrap.bundle.min.js')}}" ></script>
<script type="text/javascript" >
function ax(){
//e.preventDefault();
var file = document.getElementById("file");
let request = new XMLHttpRequest();
request.open("post",'/uploader', true);
//request.setRequestHeader("Content-Type", "multipart/form-data");
var fd = new FormData();
var files = file.files;
for (var i = 0; i < files.length; i++) {
fd.append("file", file.files[i]);
}
request.upload.addEventListener('progress', event => {
let percent_complete = (event.loaded / event.total)*100;
console.log(percent_complete);
var pbar0 = document.getElementById("pbar0");
var pbar = document.getElementById("pbar");
pbar0.style = "display: block;"
pbar.style.width = String(Math.round(percent_complete)) + "%";
pbar.innerHTML = String(Math.round(percent_complete)) + "%";
});
request.addEventListener('load', function(e) {
window.location.reload();
});
request.send(fd);
}
function viewItem(res,val) {
const list = document.querySelectorAll(res);
for (const item of list) {
item.hidden = !val
}
}
</script>
<!--</div>-->
</body>
</html>