diff --git a/frontend/views/Browser.vue b/frontend/views/Browser.vue index 2bea65e..34d4e60 100644 --- a/frontend/views/Browser.vue +++ b/frontend/views/Browser.vue @@ -8,7 +8,7 @@ - + {{ lang('Drop files to upload') }} diff --git a/frontend/views/partials/Upload.vue b/frontend/views/partials/Upload.vue index b6edddd..6f8e467 100644 --- a/frontend/views/partials/Upload.vue +++ b/frontend/views/partials/Upload.vue @@ -76,10 +76,7 @@ export default { }, watch: { 'files' (files) { - this.visible = true - this.progressVisible = true _.forEach(files, file => { - file.relativePath = this.$store.state.cwd.location this.resumable.addFile(file) }) }, @@ -92,6 +89,7 @@ export default { }, withCredentials: true, simultaneousUploads: this.$store.state.config.upload_simultaneous, + minFileSize: 0, chunkSize: this.$store.state.config.upload_chunk_size, maxFileSize: this.$store.state.config.upload_max_size, maxFileSizeErrorCallback: (file) => { @@ -104,7 +102,7 @@ export default { } }) - if (! this.resumable.support) { + if (!this.resumable.support) { this.$dialog.alert({ type: 'is-danger', message: this.lang('Browser not supported.'), @@ -112,11 +110,21 @@ export default { return } - this.resumable.on('fileAdded', () => { - if (! this.paused) { + this.resumable.assignDrop(document.getElementById('dropzone')) + + this.resumable.on('fileAdded', (file) => { + this.visible = true + this.progressVisible = true + + if(file.relativePath === undefined || file.relativePath === null || file.relativePath == file.fileName) file.relativePath = this.$store.state.cwd.location + else file.relativePath = [this.$store.state.cwd.location, file.relativePath].join('/').replace('//', '/').replace(file.fileName, '').replace(/\/$/, '') + + if (!this.paused) { this.resumable.upload() } + }) + this.resumable.on('fileSuccess', (file) => { file.file.uploadingError = false this.$forceUpdate()