Complete
This commit is contained in:
parent
4f75b0622b
commit
ceb238a413
@ -1,30 +0,0 @@
|
|||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Document</title>
|
|
||||||
<style>
|
|
||||||
.w-full {
|
|
||||||
height: 90%;
|
|
||||||
width: 90%;
|
|
||||||
padding: 0%;
|
|
||||||
margin: 0%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script defer src="./index.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
class="w-full"
|
|
||||||
type="file"
|
|
||||||
id="fileInput"
|
|
||||||
webkitdirectory="true"
|
|
||||||
mozdirectory="true"
|
|
||||||
directory="true"
|
|
||||||
multiple
|
|
||||||
/>
|
|
||||||
<button id="uploadButton">Upload and Zip Files</button>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,32 +0,0 @@
|
|||||||
document.getElementById("uploadButton").addEventListener("click", async () => {
|
|
||||||
const fileInput = document.getElementById("fileInput");
|
|
||||||
const files = Array.from(fileInput.files);
|
|
||||||
|
|
||||||
if (files.length === 0) {
|
|
||||||
alert("Please select some files first.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const formData = new FormData();
|
|
||||||
|
|
||||||
formData.append("bounty_id", 7);
|
|
||||||
files.forEach((file) => {
|
|
||||||
formData.append("files", file); // Append each file to FormData
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch("http://localhost:5000/submit-solution", {
|
|
||||||
method: "POST",
|
|
||||||
body: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("Network response was not ok");
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
console.log("Upload successful:", data);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error uploading files:", error);
|
|
||||||
}
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user