maximum file count

This commit is contained in:
xenofem 2022-04-28 00:27:22 -04:00
parent c78844d8b1
commit 7d8c4f00fa
2 changed files with 15 additions and 5 deletions

View file

@ -1,4 +1,5 @@
const FILE_CHUNK_SIZE = 16384;
const MAX_FILES = 256;
const fileInputContainer = document.getElementById('file_input_container');
const fileInput = document.getElementById('file_input');
@ -86,6 +87,7 @@ function updateFiles() {
uploadButton.textContent = `Upload ${files.length} file${files.length > 1 ? 's' : ''} (${displaySize(totalBytes)})`;
uploadButton.style.display = '';
}
fileInput.disabled = (files.length >= MAX_FILES);
}
updateFiles();
@ -93,6 +95,7 @@ downloadLinkContainer.style.display = 'none';
progressContainer.style.display = 'none';
function addFile(newFile) {
if (files.length >= MAX_FILES) { return; }
if (files.some((oldFile) => newFile.name === oldFile.name)) { return; }
files.push(newFile);