Hey there,
the upload button should work pretty easily:
uploadElement.startUpload()
.then(data => {
console.log(data)
doSomething()
})
.catch(uploadError => {
console.log(uploadError)
doSomethingElse()
})
The documentation supports this.
So my case is that while uploading the user can easily select a file which is not supported
- just like this.
And if a user does that and selects a file which isn’t supported, then the upload begins, the code doesn’t enter neither .then nor .catch.
The code fails inside some Wix function which is executed along the way and it’s not sent into the catch. In the console I receive this
Going through the Stacktrace doesn’t reveal any additional info and therefore I can’t know what’s wrong.
This error BREAKS the execution of my code and anything which should happen after doesn’t.
I tried to Try Catch the entire upload section, but it breaks even the Try Catch.
So my question is - How can I easily prevent a user from uploading a wrong file-type?
Is this a mistake on the side of Wix? Did they not consider this possibility? Or is there something else going on that causes this?