Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onComplete also triggers on errors with async upload #23

Closed
SimJoSt opened this issue Feb 23, 2018 · 1 comment
Closed

onComplete also triggers on errors with async upload #23

SimJoSt opened this issue Feb 23, 2018 · 1 comment

Comments

@SimJoSt
Copy link

SimJoSt commented Feb 23, 2018

We use async and automatic upload and wanted to use the onError config option to trigger the validation, if a file isn't properly uploaded. It's important, so the customer realizes, that something is wrong more prominently (css adjustments) and is not able to submit the form.
On resolution of these errors (retry/change to correct filesize/...) we want to pass the validation. onComplete seemed perfect for that, unfortunately though, it is triggered on every upload try. It doesn't matter if it's successful or not. Even an unsuccessful retry, will trigger onComplete.
I believe it to be caused by our usage of the async and automatic upload.

As the documentation states

Callback fired after all files were uploaded

I expect onComplete only to trigger, if all files have been uploaded successfully.

@innostudio
Copy link
Owner

@SimJoSt onComplete need to be called for both success/error uploads. We would like to keep the same logic as the jQuery does - http://api.jquery.com/jquery.ajax/.

What you need is to use the API method and in a foreach to check if all files are uploaded or not - item.uploaded == true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants