title: Unable to use variables inside promise
body: <p>I am trying to updload a picture to firebase storage, no problem with that.</p>
  
  <p>However when I try to set the state with the image URL and some other things that I am getting from a form, my variables (section and price) are empty inside the promise. Below my code:</p>
  
  <pre><code>    handleForm = e =&gt;{
      e.preventDefault();
  
      const {section, price, image} = e.target
  
      const file = image.files[0]
      const pictureName = userInformation.name.replace(/ /g, "_");
      if(file.size &lt;= 1000000){
        const myRoute = '/img/userPictures/' + pictureName;
        const storageRef = firebase.storage().ref(myRoute);
        const task = storageRef.put(file);
        task.on('state_changed', snapshot =&gt;{
          console.log('Uploaded');
        }, error =&gt;{
          console.log(error.message)
        }, () =&gt;{
          task.snapshot.ref.getDownloadURL().then(downloadURL =&gt;{
            this.setState({
              information: this.state.data.concat([{
                section: section.value, 
                price: price.value, 
                image:downloadURL}])
            })
          });
        })
        e.currentTarget.reset();
        this.notifySuccess('Information uploaded');
      }else{
        this.notifyError('Image should be less than 1 MB')
      }
      }
  </code></pre>
  
  <p>Where do I have the error? thanks!</p>