diff --git a/Webserver/src/routes/image/+page.svelte b/Webserver/src/routes/image/+page.svelte index 0a4717a..cadd518 100644 --- a/Webserver/src/routes/image/+page.svelte +++ b/Webserver/src/routes/image/+page.svelte @@ -13,7 +13,18 @@ async function loadImage(url: string): Promise {} - function uploadImage(event: Event) {} + function uploadImage(event: Event) { + // Revoke previous image url, if any + if (imageURL) URL.revokeObjectURL(imageURL); + + // Get user input + const input = event.target as HTMLInputElement; + const file = input?.files?.[0]; + if (!file) return; + + // Load image data from file + imageURL = URL.createObjectURL(file); + }