Implementing file upload
We're going to cover how we can we implement file upload in our application following a really cool example we're going to build
The example contains one single application with a button that will open the file picker. Once the file is selected the Upload
process will start, so let's see how we can make this process happen.
How to do it...
- To upload a file, we need to first create a new reference to the created file. We already know that we got a reference to the root folder, as we saw it earlier in this chapter. The code for creating a new reference to the created file is as follows:
//Creating a new reference for the uploaded file.
let imageRef = packtRef.child(`images/${<imageName>.
<ext>}`);
- You may wonder how can we programmatically create a folder. The current API doesn't have that capability, but Firebase does it automatically. This means that since we know we're pointing to a file that is in the
images
folder or any sub-folder...