diff options
| author | Julian Hurst <ark@mansus.space> | 2025-01-23 03:14:14 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2025-01-23 03:14:14 +0100 |
| commit | 0408d03a29c7aced3d4730df8fee1662cba4a4dd (patch) | |
| tree | 5797905a642e2f8368a796f783fe3a5791364629 /templates | |
| download | box-0408d03a29c7aced3d4730df8fee1662cba4a4dd.tar.gz | |
Initial commit
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/index.html | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..220c8c9 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,32 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <title>box</title> + <script> + function upload() { + f = document.getElementById("file").files[0]; + const xhr = new XMLHttpRequest(); + xhr.upload.addEventListener("progress", (e) => { + p = document.getElementById("progress") + ratio = e.loaded / e.total; + perc = Math.floor(ratio * 100); + p.innerHTML = perc + "%"; + }); + xhr.open("POST", "/" + f.name, true); + xhr.send(f) + /*const response = await fetch("/" + name, { + method: "POST", + body: f, + });*/ + } + </script> + </head> + <body> + <h1>Box</h1> + <pre>Server for uploading files. Use the form here or send a POST request to /[filename] with the content of the file in the body.</pre> + <input type="file" id="file"/><br/><br/> + <button type="button" onclick="upload()">Upload</button><br/> + <span id="progress"></span> + </body> +</html> |
