diff --git a/app/javascript/submission_form/dropzone.vue b/app/javascript/submission_form/dropzone.vue index 29ec6798..89e01b3b 100644 --- a/app/javascript/submission_form/dropzone.vue +++ b/app/javascript/submission_form/dropzone.vue @@ -112,11 +112,23 @@ export default { onSelectFiles (e) { e.preventDefault() - this.uploadFiles(this.$refs.input.files).then(() => { - if (this.$refs.input) { - this.$refs.input.value = '' + const files = Array.from(this.$refs.input.files).filter((f) => { + if (this.accept === 'image/*') { + return f.type.startsWith('image') + } else { + return true } }) + + if (this.accept === 'image/*' && !files.length) { + alert(this.t('please_upload_an_image_file')) + } else { + this.uploadFiles(files).then(() => { + if (this.$refs.input) { + this.$refs.input.value = '' + } + }) + } }, async uploadFiles (files) { this.isLoading = true