added more functionality to the shadowbox part of the profile page

This commit is contained in:
2023-03-30 10:04:15 -04:00
parent 1b0753912a
commit 2732bedbe9
3 changed files with 44 additions and 1 deletions

22
Profile Page/scripts.js Normal file
View File

@@ -0,0 +1,22 @@
function uploadShadowbox() {
const shadowboxInput = document.querySelector('input[name="shadowboxInput"]');
shadowboxInput.click();
}
//lol I have no idea what this does its an HTTP POST request thats all I know
function handleShadowboxUpload(input) {
const file = input.files[0];
const formData = new FormData();
formData.append('shadowboxFile', file);
const xhr = new XMLHttpRequest();
xhr.open('POST', '/uploadShadowbox');
xhr.onload = function () {
if (xhr.status === 200) {
console.log('File uploaded successfully');
} else {
console.error('Error uploading file');
}
};
xhr.send(formData);
}