Solving the Async Upload Multiple Files Problem in Firebase Storage with Vue.js

preview_player
Показать описание
---

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Async upload multiple files and getting their urls in firebase storage problem

If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---

Understanding the Problem

Step-By-Step Solution

Here's a detailed breakdown of how to effectively manage async uploads and ensure you retrieve download URLs for each file properly.

1. Modify the File Upload Logic

One of the main solutions is to create a clear chain of async functions. By restructuring the flow, we can ensure that uploads complete before attempting to retrieve any data (like download URLs).

Revised saveFiles Method

The first step is to check if there are any files to upload. If not, we directly proceed to upload the main image. Here’s how you can structure it:

[[See Video to Reveal this Text or Code Snippet]]

2. Refining the uploadImageFile Method

Next, ensure the method responsible for uploading the main image also properly waits for the upload to finish before calling the save method. Here’s the refined version:

[[See Video to Reveal this Text or Code Snippet]]

3. Finalizing the Save Method

Finally, make sure that in the save method, you are retrieving the download URL after all uploads:

[[See Video to Reveal this Text or Code Snippet]]

Conclusion

Рекомендации по теме
welcome to shbcf.ru