F diff --git a/loggedin.js b/loggedin.js --- a/loggedin.js +++ b/loggedin.jsconst the_file = document.getElementById("the_file");const filename_input = document.getElementById("filename");const upload_btn = document.getElementById("upload_btn");+ const current_directory = document.getElementById("current_directory");the_file.onchange = on_file_added;- function on_file_added(e) {+ const files = [];++ const pending_uploads = [];++ function on_file_added(_e) {if (the_file.files.length >= 1) {filename_input.value = the_file.files[0].name;fetch(upload_form.action, {method: upload_form.method,body: new FormData(upload_form)- })+ }).then((resp) => {+ if (resp.status == 200) {+ add_file_visuals(filename_input.value, true);+ }+ else {+ alert("Upload failed");+ }+ }, () => {+ alert("Upload failed")+ });+- alert("Sent the upload request");}else {alert("No files selected");}+ function add_file_visuals(name, pending) {+ var fileDiv = document.createElement('div');++ var img = document.createElement('img');+ var filename = document.createElement('div');++ img.src="/mimeicons/application-pdf.png";+ fileDiv.classList.add('file');+ filename.classList.add('filename');+ filename.innerText = name;++ fileDiv.appendChild(img);+ fileDiv.appendChild(filename);++ current_directory.appendChild(fileDiv);++ files.push([name, fileDiv]);++ return fileDiv;+ }+function begin_upload() {the_file.click();}F diff --git a/loggedin.php b/loggedin.php --- a/loggedin.php +++ b/loggedin.php-<div><div class="filesystem"><h2 style="display: flex; gap: 1rem;"><input id="upload_btn" type="button" value="Upload" onclick="begin_upload()"></h2>- <div class="files">- <div class="file">- <img src="/mimeicons/application-pdf.png">- <div class="filename">asdf</div>- </div>+ <div class="files" id="current_directory"></div></div>