diff --git a/index.php b/index.php index 4c98c04..3df4180 100644 --- a/index.php +++ b/index.php @@ -23,6 +23,10 @@ +
+
+
+

- + + diff --git a/main.js b/main.js index 408aced..dfb6dc5 100644 --- a/main.js +++ b/main.js @@ -17,12 +17,25 @@ buttons.forEach((button) => { }); const fileInput = document.getElementById('upload'); +const progressBar = document.getElementById('progress'); fileInput.addEventListener('change', async function (event) { const file = event.target.files[0]; let formData = new FormData(); formData.append("file", file); - const response = await fetch('upload.php', { method: "POST", body: formData }); - if (response.status === 200) { + // const response = await fetch('upload.php', { method: "POST", body: formData }); + // if (response.status === 200) { + // window.location.reload(false); + // } + axios.request({ + method: "post", + url: "upload.php", + data: formData, + headers: { "Content-Type": "multipart/form-data" }, + onUploadProgress: (p) => { + progressBar.style.display = 'block'; + progressBar.style.width = `${p.loaded / p.total}%`; + } + }).then (data => { window.location.reload(false); - } -}); \ No newline at end of file + }) +});