diff --git a/Webserver/src/routes/image/+page.svelte b/Webserver/src/routes/image/+page.svelte index 9caafd3..1fb12b2 100644 --- a/Webserver/src/routes/image/+page.svelte +++ b/Webserver/src/routes/image/+page.svelte @@ -7,20 +7,25 @@ interval: NodeJS.Timeout; } - let imageURL: string, uploadData: UploadData; + let imageURL: string | null, lastImage: File; + let uploadData: UploadData; async function sendImage() {} function uploadImage(event: Event) { // Revoke previous image url, if any - if (imageURL) URL.revokeObjectURL(imageURL); + if (imageURL) { + URL.revokeObjectURL(imageURL); + imageURL = null; + } // Get user input const input = event.target as HTMLInputElement; const file = input?.files?.[0]; if (!file) return; - // Load image data from file + // Load image data and file + lastImage = file; imageURL = URL.createObjectURL(file); // Time upload by saving date