The basic implementation of the addFileAttachmentAsync is as follows:

  (result) => {
    console.log('error or success')

Now this works. If I call this multiple times for multiple files, it works. All the files get uploaded. But one problem. The callback gets fired only once. Let's say there were two files and both files throw errors. I'll be able to read the error of only one file. How can I fix this and make the callback run for all executions separately?

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.