Files
upload_big_files/index.html

74 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="lib_chunk_file.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
li {
padding: 10px 15px;
list-style: none;
border:solid 1px #ddd;
border-radius: 5px;
width: max-content;
}
li span {
display: inline-block;
margin: 0 15px 0 0;
}
</style>
</head>
<body>
<input type="file" multiple name="file_name">
<script>
const fileInput = document.querySelector('input[type="file"]');
fileInput.addEventListener('change', (event) => {
statuss= document.createElement("ul");
event.target.after(statuss);
const files = event.target.files;
for (fil in files){
file = files[fil]
if (file.size) {
console.log(">>>>>>>>",fil)
li = document.createElement("li");
namefile = document.createElement("span");
namefile.innerHTML =file.name;
chanh = document.createElement("b");
chanh.id="status_bar_"+fil
chanh.innerHTML = 0;
full = document.createElement("b");
full.innerHTML = " / " + Number(file.size/1024/1024).toFixed(2);
li.append(namefile);
li.append(chanh);
li.append(full);
statuss.append(li);
uploadFileInChunks(file,fil);
}
}
});
</script>
</body>
</html>