Upload dropped folders file by file

This commit is contained in:
Mikei386
2026-06-23 21:42:01 +02:00
parent dfd6bfec57
commit 9d5903dcf6
6 changed files with 15 additions and 13 deletions
+11 -9
View File
@@ -901,17 +901,19 @@ async function uploadFileList(win, files, targetPath) {
return;
}
if (!files.length) return;
const form = new FormData();
const uploadItems = normalizeUploadItems(files);
for (const item of uploadItems) {
form.append('files[]', item.file, item.file.name);
form.append('paths[]', item.path);
for (const [index, item] of uploadItems.entries()) {
recordDebug('upload.file.request', { path: item.path, size: item.file.size, index: index + 1, total: uploadItems.length });
const form = new FormData();
form.append('files', item.file, item.file.name);
form.append('relativePath', item.path);
appendCsrf(form);
await fetchChecked(apiUrl(`upload.php?path=${encodeURIComponent(targetPath)}`), {
method: 'POST',
body: form
});
recordDebug('upload.file.done', { path: item.path, index: index + 1, total: uploadItems.length });
}
appendCsrf(form);
await fetchChecked(apiUrl(`upload.php?path=${encodeURIComponent(targetPath)}`), {
method: 'POST',
body: form
});
await loadExplorer(win, targetPath);
}