show alert when upload non pdf or image

pull/105/head
Alex Turchyn 2 years ago
parent 7912c9a1ee
commit 7697b94f73

@ -101,9 +101,13 @@ export default {
methods: { methods: {
upload: Upload.methods.upload, upload: Upload.methods.upload,
onDropFiles (e) { onDropFiles (e) {
if ([...e.dataTransfer.files].every((f) => f.type.match(/(?:image\/)|(?:application\/pdf)/))) {
this.$refs.input.files = e.dataTransfer.files this.$refs.input.files = e.dataTransfer.files
this.upload() this.upload()
} else {
alert('Only PDF and images are supported.')
}
} }
} }
} }

Loading…
Cancel
Save