uploaded images saved to Pi
This commit is contained in:
@@ -486,11 +486,22 @@ var allFeaturesFileAddBtn = [
|
||||
null,
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
var uploaded_images = [];
|
||||
var uploaded_GIFs = [];
|
||||
|
||||
allFeaturesFileAddBtn.map((value, index) => {
|
||||
if (value !== null) {
|
||||
value.addEventListener("click", () => {
|
||||
var tag = document.createElement("li");
|
||||
tag.innerHTML = allFeaturesFile[index].files[0].name;
|
||||
if (index == 10) {
|
||||
uploaded_images.push(allFeaturesFile[index].files[0]);
|
||||
} else if (index == 11) {
|
||||
uploaded_GIFs.push(allFeaturesFile[index].files[0]);
|
||||
}
|
||||
|
||||
allFeatures[index].appendChild(tag);
|
||||
changeVarValue();
|
||||
@@ -685,6 +696,35 @@ function saveSettings() {
|
||||
method:"PUT",
|
||||
body:JSON.stringify(settings)
|
||||
});
|
||||
|
||||
//send uploaded images and gifs
|
||||
if (pageNum == 11){
|
||||
var data = new FormData();
|
||||
|
||||
for ( var i = 0; i < uploaded_images.length; i++ ) {
|
||||
data.append(uploaded_images[i].name, uploaded_images[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
fetch("/upload", {
|
||||
method:"POST",
|
||||
body:data
|
||||
});
|
||||
|
||||
|
||||
} else if (pageNum == 12) {
|
||||
var data = new FormData();
|
||||
|
||||
for ( var i = 0; i < uploaded_GIFs.length; i++ ) {
|
||||
data.append(uploaded_GIFs[i].name, uploaded_GIFs[i]);
|
||||
}
|
||||
|
||||
fetch("/upload", {
|
||||
method:"POST",
|
||||
body:data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let saveSettingsButtons = document.querySelectorAll(".save-btn-div").forEach(button =>
|
||||
|
Reference in New Issue
Block a user