22 lines
686 B
JavaScript
22 lines
686 B
JavaScript
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);
|
|
} |