diff --git a/src/components/layout/AppUploadAndPrintBtn.vue b/src/components/layout/AppUploadAndPrintBtn.vue
index 55d893f377..84ddb85b33 100644
--- a/src/components/layout/AppUploadAndPrintBtn.vue
+++ b/src/components/layout/AppUploadAndPrintBtn.vue
@@ -49,8 +49,11 @@ export default class AppUploadAndPrintBtn extends Vue {
fileChanged (e: Event) {
const target = e.target as HTMLInputElement
- if (target?.files?.length === 1) {
- this.$emit('upload', target.files[0])
+ if (target) {
+ if (target.files?.length === 1) {
+ this.$emit('upload', target.files[0])
+ }
+
target.value = ''
}
}
diff --git a/src/components/widgets/filesystem/FileSystem.vue b/src/components/widgets/filesystem/FileSystem.vue
index 99514655a2..e55f3c6a39 100644
--- a/src/components/widgets/filesystem/FileSystem.vue
+++ b/src/components/widgets/filesystem/FileSystem.vue
@@ -156,6 +156,7 @@ import FileSystemUploadDialog from './FileSystemUploadDialog.vue'
import FilePreviewDialog from './FilePreviewDialog.vue'
import Axios from 'axios'
import { AppTableHeader } from '@/types'
+import { FileWithPath, getFilesFromDataTransfer } from '@/util/file-system-entry'
/**
* Represents the filesystem, bound to moonrakers supplied roots.
@@ -821,7 +822,7 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
}
}
- async handleUpload (files: FileList | File[], print: boolean) {
+ async handleUpload (files: FileList | File[] | FileWithPath[], print: boolean) {
this.$store.dispatch('wait/addWait', this.$waits.onFileSystem)
this.uploadFiles(files, this.visiblePath, this.currentRoot, print)
this.$store.dispatch('wait/removeWait', this.$waits.onFileSystem)
@@ -912,8 +913,15 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM
async handleDropFile (e: DragEvent) {
this.dragState.overlay = false
- if (e && e.dataTransfer && e.dataTransfer.files.length && !this.rootProperties.readonly) {
- this.handleUpload(e.dataTransfer.files, false)
+
+ if (!e.dataTransfer || this.rootProperties.readonly) {
+ return
+ }
+
+ const files = await getFilesFromDataTransfer(e.dataTransfer)
+
+ if (files) {
+ this.handleUpload(files, false)
}
}
}
diff --git a/src/components/widgets/filesystem/FileSystemMenu.vue b/src/components/widgets/filesystem/FileSystemMenu.vue
index 56f5838686..7447aeec33 100644
--- a/src/components/widgets/filesystem/FileSystemMenu.vue
+++ b/src/components/widgets/filesystem/FileSystemMenu.vue
@@ -40,7 +40,22 @@
>
$fileUpload
- {{ $t('app.general.btn.upload') }}
+ {{ $t('app.general.btn.upload_files') }}
+
+
+
+
+
+ $folderUpload
+
+ {{ $t('app.general.btn.upload_folder') }}