Skip to content

feat(ux): support uploading folders from the file manager - #5677

Open
stijnwtf wants to merge 1 commit into
pterodactyl:1.0-developfrom
stijnwtf:1.0-develop
Open

feat(ux): support uploading folders from the file manager#5677
stijnwtf wants to merge 1 commit into
pterodactyl:1.0-developfrom
stijnwtf:1.0-develop

Conversation

@stijnwtf

@stijnwtf stijnwtf commented Jul 7, 2026

Copy link
Copy Markdown

Adds a folder option alongside file upload, using webkitdirectory input and dataTransfer.items with FileSystemEntry traversal for drag-and-drop, so subdirectories are recreated via the create-folder API before their files are uploaded to the right path.

Adds a folder option alongside file upload, using webkitdirectory
input and dataTransfer.items with FileSystemEntry traversal for
drag-and-drop, so subdirectories are recreated via the create-folder
API before their files are uploaded to the right path.
Copilot AI review requested due to automatic review settings July 7, 2026 13:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UX support for uploading folders (via picker + drag-and-drop traversal) so that subdirectories are recreated in the server file manager before uploading files into their corresponding paths.

Changes:

  • Add a dropdown to choose between uploading files vs. a folder (using webkitdirectory).
  • Implement drag-and-drop folder traversal via dataTransfer.items and FileSystemEntry recursion.
  • Pre-create nested directories via the create-folder API before uploading files with per-file target directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 207 to +210
visible.value = false;
if (!e.dataTransfer?.files.length) return;

onFileSubmission(e.dataTransfer.files);
if (e.dataTransfer?.items.length) {
handleDropItems(e.dataTransfer.items);
}
Comment on lines +186 to 194
const handleDropItems = async (items: DataTransferItemList) => {
const entries = Array.from(items)
.filter((item) => item.kind === 'file')
.map((item) => item.webkitGetAsEntry())
.filter((entry): entry is FileSystemEntry => entry !== null);

const results = await Promise.all(entries.map((entry) => getAllFilesFromEntry(entry)));
uploadFilesWithPaths(results.flat());
};
Comment on lines +176 to +180
} catch (error: unknown) {
clearFileUploads();
clearAndAddHttpError(error);
});
clearAndAddHttpError(error instanceof Error ? error : String(error));
return;
}
Comment on lines +151 to +155
for (const { file, relativePath } of filesWithPaths) {
const controller = new AbortController();
const lastSlash = relativePath.lastIndexOf('/');
const subDir = lastSlash > 0 ? relativePath.substring(0, lastSlash) : '';
const targetDirectory = subDir ? `${base}/${subDir}` : directory;
Comment on lines +144 to +148
try {
await createDirectory(uuid, dirRoot, dirName);
} catch {
// Directory may already exist — creation failures here shouldn't block the upload.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants