fix: drag and drop not making button available
This commit is contained in:
@@ -218,12 +218,14 @@
|
|||||||
zone.classList.add('active');
|
zone.classList.add('active');
|
||||||
};
|
};
|
||||||
zone.ondragleave = () => zone.classList.remove('active');
|
zone.ondragleave = () => zone.classList.remove('active');
|
||||||
|
|
||||||
zone.ondrop = (e) => {
|
zone.ondrop = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
zone.classList.remove('active');
|
zone.classList.remove('active');
|
||||||
|
|
||||||
if (e.dataTransfer.files.length) {
|
if (e.dataTransfer.files.length) {
|
||||||
input.files = e.dataTransfer.files;
|
input.files = e.dataTransfer.files;
|
||||||
showFile(e.dataTransfer.files[0]);
|
input.dispatchEvent(new Event('change'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -293,7 +295,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
xhr.onload = () => {
|
xhr.onload = () => {
|
||||||
// Check if the server actually returned a success status (200-299)
|
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(xhr.responseText);
|
const data = JSON.parse(xhr.responseText);
|
||||||
@@ -309,10 +310,9 @@
|
|||||||
document.getElementById('res-del').value = delUrl;
|
document.getElementById('res-del').value = delUrl;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("JSON Parse Error. Server sent:", xhr.responseText);
|
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 {
|
} else {
|
||||||
// If the server sent a 404, 413 (File too large), or 500 error
|
|
||||||
console.error("Server Error:", xhr.status, xhr.responseText);
|
console.error("Server Error:", xhr.status, xhr.responseText);
|
||||||
alert(`Upload failed with status ${xhr.status}. Check console.`);
|
alert(`Upload failed with status ${xhr.status}. Check console.`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user