Upload dropped folders file by file
This commit is contained in:
+11
-9
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user