Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +15 -10
static/index.html
CHANGED
@@ -302,19 +302,19 @@ input[type="number"]#scale:focus {
|
|
302 |
|
303 |
|
304 |
function previewImage(event, imageId) {
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
}
|
313 |
-
|
314 |
-
reader.readAsDataURL(file);
|
315 |
}
|
316 |
|
317 |
-
|
|
|
|
|
|
|
318 |
async function handleSubmit(event) {
|
319 |
event.preventDefault();
|
320 |
const formData = new FormData(this);
|
@@ -350,6 +350,11 @@ async function handleSubmit(event) {
|
|
350 |
} catch (error) {
|
351 |
console.error('Error:', error);
|
352 |
}
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
|
355 |
// Add event listener to the form
|
|
|
302 |
|
303 |
|
304 |
function previewImage(event, imageId) {
|
305 |
+
const fileInput = event.target;
|
306 |
+
const file = fileInput.files[0];
|
307 |
+
const reader = new FileReader();
|
308 |
|
309 |
+
reader.onload = function(e) {
|
310 |
+
const image = document.getElementById(imageId);
|
311 |
+
image.src = e.target.result;
|
|
|
|
|
|
|
312 |
}
|
313 |
|
314 |
+
reader.readAsDataURL(file);
|
315 |
+
}
|
316 |
+
|
317 |
+
// Function to handle form submission
|
318 |
async function handleSubmit(event) {
|
319 |
event.preventDefault();
|
320 |
const formData = new FormData(this);
|
|
|
350 |
} catch (error) {
|
351 |
console.error('Error:', error);
|
352 |
}
|
353 |
+
|
354 |
+
// Remove the existing event listener
|
355 |
+
this.removeEventListener('submit', handleSubmit);
|
356 |
+
// Reattach the event listener
|
357 |
+
this.addEventListener('submit', handleSubmit);
|
358 |
}
|
359 |
|
360 |
// Add event listener to the form
|