This commit is contained in:
Koshin S Hegde 2024-08-26 18:45:23 +05:30
parent 4f75b0622b
commit ceb238a413
2 changed files with 0 additions and 62 deletions

View File

@ -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>

View File

@ -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);
}
});