my
Browse files- templates/index3.html +0 -25
templates/index3.html
CHANGED
|
@@ -81,31 +81,6 @@
|
|
| 81 |
const downloadCsvButton = document.getElementById('download-csv');
|
| 82 |
const downloadImageButton = document.getElementById('download-image');
|
| 83 |
|
| 84 |
-
// Listen for file selection and temporarily store it in localStorage
|
| 85 |
-
invoiceInput.addEventListener('change', () => {
|
| 86 |
-
const file = invoiceInput.files[0];
|
| 87 |
-
if (file) {
|
| 88 |
-
const fileData = URL.createObjectURL(file);
|
| 89 |
-
localStorage.setItem('selectedFile', fileData);
|
| 90 |
-
window.location.reload(); // Trigger page reload
|
| 91 |
-
}
|
| 92 |
-
});
|
| 93 |
-
|
| 94 |
-
// Check if a file is stored in localStorage upon page reload
|
| 95 |
-
window.onload = () => {
|
| 96 |
-
const storedFile = localStorage.getItem('selectedFile');
|
| 97 |
-
if (storedFile) {
|
| 98 |
-
// Reassign the selected file URL back to the file input
|
| 99 |
-
const fakeFile = new File([storedFile], "fakeFile.jpg", {type: "image/*"});
|
| 100 |
-
const dataTransfer = new DataTransfer();
|
| 101 |
-
dataTransfer.items.add(fakeFile);
|
| 102 |
-
invoiceInput.files = dataTransfer.files;
|
| 103 |
-
|
| 104 |
-
// Clean up localStorage
|
| 105 |
-
localStorage.removeItem('selectedFile');
|
| 106 |
-
}
|
| 107 |
-
};
|
| 108 |
-
|
| 109 |
uploadBtn.addEventListener('click', () => {
|
| 110 |
const file = invoiceInput.files[0];
|
| 111 |
if (!file) return alert('Please select a file.');
|
|
|
|
| 81 |
const downloadCsvButton = document.getElementById('download-csv');
|
| 82 |
const downloadImageButton = document.getElementById('download-image');
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
uploadBtn.addEventListener('click', () => {
|
| 85 |
const file = invoiceInput.files[0];
|
| 86 |
if (!file) return alert('Please select a file.');
|