-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFileUpload.html
More file actions
27 lines (24 loc) · 1.01 KB
/
Copy pathFileUpload.html
File metadata and controls
27 lines (24 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<script>
document.addEventListener("DOMContentLoaded", function() {
// Get the form and input elements
const form = document.getElementById("syllabusForm");
const fileInput = document.getElementById("syllabusFile");
// Add event listener for form submission
form.addEventListener("submit", function(event) {
event.preventDefault(); // Prevent default form submission behavior
const file = fileInput.files[0]; // Get the selected file
if (file) {
// File is selected, proceed with upload
uploadSyllabus(file);
} else {
alert("Please select a file to upload.");
}
});
// Function to handle syllabus file upload
function uploadSyllabus(file) {
// You can implement the file upload logic here
// For now, let's just log the file details
console.log("Uploaded file:", file.name, file.type, file.size);
}
});
</script>