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
+1 -1
View File
@@ -2,7 +2,7 @@
set -eu set -eu
PLUGIN="u-navigator" PLUGIN="u-navigator"
VERSION="2026.06.23.r044" VERSION="2026.06.23.r045"
PKG_DIR="packages" PKG_DIR="packages"
WORK_DIR=".plugin-build" WORK_DIR=".plugin-build"
PKG_NAME="${PLUGIN}-${VERSION}.tgz" PKG_NAME="${PLUGIN}-${VERSION}.tgz"
Binary file not shown.
Binary file not shown.
@@ -11,7 +11,7 @@ $uploaded = [];
$names = unav_upload_array($_FILES['files']['name'] ?? []); $names = unav_upload_array($_FILES['files']['name'] ?? []);
$errors = unav_upload_array($_FILES['files']['error'] ?? []); $errors = unav_upload_array($_FILES['files']['error'] ?? []);
$tmpNames = unav_upload_array($_FILES['files']['tmp_name'] ?? []); $tmpNames = unav_upload_array($_FILES['files']['tmp_name'] ?? []);
$relativePaths = unav_upload_array($_POST['paths'] ?? []); $relativePaths = unav_upload_array($_POST['paths'] ?? ($_POST['relativePath'] ?? []));
foreach ($names as $index => $name) { foreach ($names as $index => $name) {
if (($errors[$index] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK) { if (($errors[$index] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK) {
unav_error(400, 'Upload failed'); unav_error(400, 'Upload failed');
+7 -5
View File
@@ -901,17 +901,19 @@ async function uploadFileList(win, files, targetPath) {
return; return;
} }
if (!files.length) return; if (!files.length) return;
const form = new FormData();
const uploadItems = normalizeUploadItems(files); const uploadItems = normalizeUploadItems(files);
for (const item of uploadItems) { for (const [index, item] of uploadItems.entries()) {
form.append('files[]', item.file, item.file.name); recordDebug('upload.file.request', { path: item.path, size: item.file.size, index: index + 1, total: uploadItems.length });
form.append('paths[]', item.path); const form = new FormData();
} form.append('files', item.file, item.file.name);
form.append('relativePath', item.path);
appendCsrf(form); appendCsrf(form);
await fetchChecked(apiUrl(`upload.php?path=${encodeURIComponent(targetPath)}`), { await fetchChecked(apiUrl(`upload.php?path=${encodeURIComponent(targetPath)}`), {
method: 'POST', method: 'POST',
body: form body: form
}); });
recordDebug('upload.file.done', { path: item.path, index: index + 1, total: uploadItems.length });
}
await loadExplorer(win, targetPath); await loadExplorer(win, targetPath);
} }
+2 -2
View File
@@ -1,7 +1,7 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "u-navigator"> <!ENTITY name "u-navigator">
<!ENTITY author "Michael Roll"> <!ENTITY author "Michael Roll">
<!ENTITY version "2026.06.23.r044"> <!ENTITY version "2026.06.23.r045">
<!ENTITY package "&name;-&version;.tgz"> <!ENTITY package "&name;-&version;.tgz">
<!ENTITY pluginURL "https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg"> <!ENTITY pluginURL "https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
<!ENTITY support "https://git.casaderoll.de/michael/Unraid-Navigator"> <!ENTITY support "https://git.casaderoll.de/michael/Unraid-Navigator">
@@ -24,7 +24,7 @@
<FILE Name="/boot/config/plugins/&name;/&package;"> <FILE Name="/boot/config/plugins/&name;/&package;">
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL> <URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
<MD5>3d681de8838b4c51cbade67d1ad0cb57</MD5> <MD5>cd3b5a92d7174924985b5d929cb180fe</MD5>
</FILE> </FILE>
<FILE Run="/bin/bash"> <FILE Run="/bin/bash">