[FEATURE] Allow folder uploads (#21)
Co-authored-by: Dunemask <dunemask@gmail.com> Reviewed-on: https://gitea.dunemask.dev/elysium/minecluster/pulls/21
This commit is contained in:
parent
b15f616adb
commit
332f84972c
2 changed files with 7 additions and 3 deletions
|
@ -111,10 +111,12 @@ export default function MineclusterFiles(props) {
|
|||
}
|
||||
|
||||
async function uploadFile(file) {
|
||||
const filePath = file.path.startsWith("/") ? file.path : `/${file.path}`;
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("id", serverId);
|
||||
formData.append("path", [...dirStack, file.name].join("/"));
|
||||
const path = `${[...dirStack].join("/")}${filePath}`;
|
||||
formData.append("path", path);
|
||||
await fetch("/api/files/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue