fix: drag and drop not making button available

This commit is contained in:
2026-03-02 01:13:21 +01:00
parent 90a2f43ab6
commit dd713b7afd

View File

@@ -218,12 +218,14 @@
zone.classList.add('active');
};
zone.ondragleave = () => zone.classList.remove('active');
zone.ondrop = (e) => {
e.preventDefault();
zone.classList.remove('active');
if (e.dataTransfer.files.length) {
input.files = e.dataTransfer.files;
showFile(e.dataTransfer.files[0]);
input.dispatchEvent(new Event('change'));
}
};
@@ -293,7 +295,6 @@
};
xhr.onload = () => {
// Check if the server actually returned a success status (200-299)
if (xhr.status >= 200 && xhr.status < 300) {
try {
const data = JSON.parse(xhr.responseText);
@@ -309,10 +310,9 @@
document.getElementById('res-del').value = delUrl;
} catch (err) {
console.error("JSON Parse Error. Server sent:", xhr.responseText);
alert("Server returned an invalid response. Check console (F12) for details.");
alert("Server returned an invalid response");
}
} else {
// If the server sent a 404, 413 (File too large), or 500 error
console.error("Server Error:", xhr.status, xhr.responseText);
alert(`Upload failed with status ${xhr.status}. Check console.`);
}