Spaces:
Running
Running
Include error handling
Browse files
index.js
CHANGED
@@ -16,7 +16,11 @@ imageUpload.addEventListener("change", async (e) => {
|
|
16 |
const image = e.target.files[0];
|
17 |
|
18 |
if (!image) {
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
imageContainer.innerHTML = "";
|
|
|
16 |
const image = e.target.files[0];
|
17 |
|
18 |
if (!image) {
|
19 |
+
return errorMsg.textContent = "The uploaded file is not an image. Please try again.";
|
20 |
+
}
|
21 |
+
|
22 |
+
if (image.type === "image/svg+xml") {
|
23 |
+
return errorMsg.textContent = "SVG images are not supported. Please try again.";
|
24 |
}
|
25 |
|
26 |
imageContainer.innerHTML = "";
|