From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Upload a file to the storage

Upload a file to the storage

- [Presenter] So in the example that follows, in this video, the goal will be to update and manage the form, and then send files to the cloud storage in order to create new documents with text and media contents. We're going to start by importing to the scope Storage. And then we're going to import this method from the Storage, which is uploadFile. Here we go. And then you want to do this from this form. Like, whenever the user hit the submit button. So you want to allow first to upload the image. And we're going to pass as a parameter the information of the inputs of the file, and then it returns a Promise. I'm going to add one debugger statement right here to stop the program, and we're going to see what we get back. So once this is fulfilled, this Promise, we want to do the next step, which is to first create a new document and then run two actions locally to update the the collection, the list of items, and also…

Contents