This commit is contained in:
SadlyNotSappho 2024-03-01 14:02:37 -08:00
parent 0644f034a8
commit f3935a8f0c
4 changed files with 45 additions and 0 deletions

3
build.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
uid=$(/usr/bin/id -u) gid=$(/usr/bin/id -g) docker compose up --build

1
images/DO_NOT_REMOVE.txt Normal file
View File

@ -0,0 +1 @@
this is a data folder! the program is able to store specific data in here, and I'm not sure if git will push an empty folder.

View File

@ -0,0 +1 @@
this is a data folder! the program is able to store specific data in here, and I'm not sure if git will push an empty folder.

40
web/uploadimage.html Normal file
View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>image test</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<form id="image-form">
<input type="file" name="file" accept="image/png">
<input type="submit" name="submit" value="submit">
</form>
</body>
<script defer>
document.getElementById("image-form").addEventListener("submit", async (event) => {
event.preventDefault();
// this doesn't work
// const file = event.target.files[0];
// console.log(file)
var input = document.querySelector('input[type="file"]')
console.log(input.files[0])
const token = await fetch("http://127.0.0.1:8000/upload", {
method: "POST",
header: {
"Content-Type": "image/png",
"Access-Control-Allow-Origin": "http://127.0.0.1:8000/upload"
},
body: input.files[0]
})
alert(await token.text());
});
</script>
</html>