diff --git a/index.html b/index.html
index 1b2425c..ba96277 100644
--- a/index.html
+++ b/index.html
@@ -71,7 +71,6 @@
diff --git a/script.js b/script.js
index 50df208..528a0cc 100644
--- a/script.js
+++ b/script.js
@@ -1572,44 +1572,48 @@ async function handleFileUpload(event) {
progressRow.appendChild(barWrap);
progressContainer.appendChild(progressRow);
- try {
- return new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- xhr.open('POST', '/upload', true);
+ return new Promise((resolve) => {
+ const xhr = new XMLHttpRequest();
+ xhr.open('POST', '/upload', true);
- xhr.upload.onprogress = (e) => {
- if (e.lengthComputable) {
- const percent = (e.loaded / e.total) * 100;
- barInner.style.width = percent + '%';
- }
- };
+ xhr.upload.onprogress = (e) => {
+ if (e.lengthComputable) {
+ const percent = (e.loaded / e.total) * 100;
+ barInner.style.width = percent + '%';
+ }
+ };
- xhr.onload = () => {
- if (xhr.status === 200) {
+ xhr.onload = () => {
+ if (xhr.status === 200) {
+ try {
const result = JSON.parse(xhr.responseText);
if (result.success) {
barInner.style.background = '#00ff88';
- resolve();
} else {
barInner.style.background = '#ff4444';
- reject(new Error(result.error));
+ nameSpan.title = result.error || 'Upload failed';
+ console.error(`[UPLOAD] ${file.name}: ${result.error}`);
}
- } else {
+ } catch (e) {
barInner.style.background = '#ff4444';
- reject(new Error(`HTTP ${xhr.status}`));
+ console.error(`[UPLOAD] Bad response for ${file.name}`);
}
- };
-
- xhr.onerror = () => {
+ } else {
barInner.style.background = '#ff4444';
- reject(new Error('Network error'));
- };
+ nameSpan.title = `HTTP ${xhr.status}`;
+ console.error(`[UPLOAD] ${file.name}: HTTP ${xhr.status}${xhr.status === 413 ? ' — file too large (nginx limit)' : ''}`);
+ }
+ resolve(); // Always resolve so other uploads continue
+ };
- xhr.send(formData);
- });
- } catch (error) {
- console.error(`[ERROR] Upload error: ${error}`);
- }
+ xhr.onerror = () => {
+ barInner.style.background = '#ff4444';
+ console.error(`[UPLOAD] ${file.name}: Network error`);
+ resolve();
+ };
+
+ xhr.send(formData);
+ });
});
// Run uploads in parallel (limited to 3 at a time for stability if needed, but let's try all)