From 7de0cead94f89eab47cfaac8395f833579a0a592 Mon Sep 17 00:00:00 2001 From: Toddeh Date: Fri, 12 Apr 2024 23:08:49 -0700 Subject: [PATCH] added test case for viewing img upload --- frontend/js/script.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/js/script.js b/frontend/js/script.js index 747bbfb..36ded2f 100644 --- a/frontend/js/script.js +++ b/frontend/js/script.js @@ -55,6 +55,14 @@ uploadButton.addEventListener('click', () => { // Send the formData to the server using fetch or XMLHttpRequest // ... console.log('Uploading file:', selectedFile.name); + + + //THIS IS A TEST CASE TO MAKE SURE IMG IS BEING UPLOADED PROPER, NEED TO CONFIG SENDING TO SERVER! + // Open the uploaded PNG image in a new tab + if (selectedFile.type === 'image/png') { + const imageUrl = URL.createObjectURL(selectedFile); + window.open(imageUrl, '_blank'); + } } else { alert('Please select a file to upload.'); }